I need to add a button at the end of my application, without the items covering the button. With my current code the button is being covered by the items in the ListView. I wanna be able to scroll through the ListView and see all the items, without the button being covered with them. I need button with id “bSave” below the Listview. My XML code:
Button
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content" android:orientation="vertical"
android:id="@+id/bottom_control_bar"
android:layout_alignParentBottom="true">
<Button android:layout_width="match_parent"
android:layout_height="wrap_content" android:text="Spara total tid"
android:id="@+id/bSave" android:textStyle="bold"
android:visibility="invisible"></Button>
</LinearLayout>
ListView
<RelativeLayout
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView android:id="@android:id/list"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_above="@id/bottom_control_bar"></ListView>
<TextView android:id="@android:id/empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
Do you want the button to always be visible, or to only be visible once you read the end of the list? If the former, then you use something like a
relativelayoutwith a footer button set toalignparentbottomandbelowthelistview. If the latter, then calllistview.addFooterView, passing in whatever view you’d like.