Android 如何在LinearLayout中使用edittext设置listview下的按钮
我想在LinearLayout中设计一个布局。我的目的是:设置一个ListView完整布局的宽度。ListView转到其他高度的末尾。之后,有一个EditText和一个按钮。EditText是布局的宽度4/3按钮。4/1。我怎么做 以下是我的布局:Android 如何在LinearLayout中使用edittext设置listview下的按钮,android,android-layout,Android,Android Layout,我想在LinearLayout中设计一个布局。我的目的是:设置一个ListView完整布局的宽度。ListView转到其他高度的末尾。之后,有一个EditText和一个按钮。EditText是布局的宽度4/3按钮。4/1。我怎么做 以下是我的布局: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/colorAccent">
<ListView
android:layout_width="match_parent"
android:layout_height="500dp"
android:id="@+id/mesajlaşma_listview"
>
</ListView>
<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="match_parent"
android:background="#FFFFFF"
>
<EditText
android:id="@+id/EditText01"
android:hint="Mesaj Yaz."
android:layout_height="40dp"
android:layout_weight="1"
android:layout_gravity="bottom"
android:background="#FFFFFF"
android:layout_width="fill_parent">
</EditText>
<Button
android:text="Gönder."
android:layout_gravity="bottom"
android:background="#FFFFFF"
android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="match_parent">
</Button>
/>
</LinearLayout>
</LinearLayout>
首先在LinearLayout中创建按钮和编辑文本,然后创建一个ListView并让它填充屏幕的剩余空间。您可以使用LinearLayout weightsum,然后设置单独的视图权重。请参见。我知道这些。但是如何创建ListView。当它的高度与父项匹配时,它将擦除buton和编辑文本。然后创建Button呢首先打开并编辑LinearLayout中的文本,然后创建ListView以填充剩余空间?你真是天才。它很有效。谢谢。