我刚刚开始使用Android.This是我的第一个项目。我使用了列表视图来并排显示EditText
和TextView
。现在我想,如果我使用的是Button
鉴于它正在对每EditText
instead.The下面显示的是我的XML文件在end.But提交按钮:对齐按钮
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/txtview"
android:text="subject"
android:layout_width="wrap_content"
android:layout_alignParentLeft="true"
android:paddingLeft="10dp"
android:textSize="25dp"
android:textColor="@color/black"
android:layout_height="wrap_content"
android:layout_weight="0.7"
android:paddingRight="20dp"
android:textStyle="bold"
/>
<EditText
android:cursorVisible="true"
android:id="@+id/ScanText"
android:hint="Internal+External"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:layout_toRightOf="@id/textView"
android:inputType="number"
android:layout_marginTop="20dp"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Submit"
android:layout_alignParentEnd="true"
android:id="@+id/submitbutton"/>
</RelativeLayout>
这是该adapter
为ListView
用途的布局。该按钮也被显示为有TextView
s.So我怎么能只显示在bottom.I一个按钮了输出below.But我只需要在底部
我甚至试过把对接在我main activity
下面ListView
。但它did'nt下面work.The是我的XML:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="match_parent"
>
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@android:id/list"></ListView>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Submit"
android:id="@+id/submitbutton"/>
</LinearLayout>
显示您预期的输出! –
从此布局中删除按钮,此布局用于列表项目。将你的按钮添加到包含listView的布局中。 –
将按钮放在活动布局中 - 而不是每次都要创建按钮 – rafsanahmad007