Try to wrap both ListView, and Buttonin your own LinearLayout, each of which has a height of 0dp and weight as a fraction of the total height of the layout.
Example: below ListView90% of the layout and Button10%. Adjust the values accordingly.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.9"
android:orientation="vertical" >
<ListView
android:id="@+id/myListView"
android:layout_width = "fill_parent"
android:layout_height = "fill_parent"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.1"
android:orientation="vertical" >
<Button
android:id="@+id/back_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="20dip"
android:text="@string/backButton_label" />
</LinearLayout>
</LinearLayout>
source
share