I know that this question already has an accepted answer, but I will still answer, since no solution has been found, and this is the first result that Google gave me about this problem, which I also had.
Just put LinearLayout (vertical) with layout:weight = 1 between the two elements you want to split.
In your code it will be
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/attachments_list" android:layout_width="fill_parent" android:layout_height="fill_parent" android:weightSum="1" android:orientation="vertical"> <ListView android:id="@+id/mtg_attachments" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="0" /> <LinearLayout <!-- You should add this one and remove android:layout_weigth="1" form the listview --> android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1"> </LinearLayout> <Button android:id="@+id/attach_delete" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:text="@string/delete" android:textSize="22sp" /> <TextView android:text="@string/attach_warning" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="18sp" /> </LinearLayout>
Please note that the added LinearLayout must be the only one with the set weight, otherwise we will have to deal with some problem.
source share