I have a layout with 3 button at the top in a row and then a ListView followed by a button below the listView. This is my layout.xml file
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button android:id="@+id/btn_top10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TOP 10"/>
<Button android:id="@+id/btn_top100"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TOP 100"
android:layout_toRightOf="@id/btn_top10"/>
<Button android:id="@+id/btn_showAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Show All"
android:layout_toRightOf="@id/btn_top100"/>
<ListView android:id="@+id/LV_Device"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/btn_top10"
android:layout_above="@id/LV_Device"/>
<Button android:id="@+id/btn_clearResult"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Clear Results"
android:layout_below="@id/LV_Device"/>
</RelativeLayout>
This will give a result like this
If i add some values to the ListView then its ok, the button below will be show
But if the listview becomes larger than the screen size then the button below that will not be visible even after scrolling to the bottom of the listView
How to solve this issue?? I don't want button to be fixed at the bottom of the screen. I want the button to be show at the end of the ListView only
Change your ListView
's height to 0dip
. Then change the attribute
android:layout_above="@id/LV_Device"
to
android:layout_above="@+id/btn_clearResult"
Finally, modify the last button by removing android:layout_below
and add instead android:layout_alignParentBottom="true"
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With