I'm trying to construct a layout where there is a text view at the top of the screen and a bottom bar at the bottom of the screen. Each of these views should stay fixed in place and in between the 2 should be a ListView.
TOPBAR
LISTVIEW (scrollable)
BOTTOM BAR
My layout (see below) almost works: the top and bottom components stay fixed and the listview scrolls. The "problem" is that the final row of my ListView remains hidden behind the bottom bar.
Any suggestions on how to adjust the layout?
Thanks!
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_alignParentTop="true"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<TextView
android:background="@drawable/blackgrad"
android:gravity="center"
android:id="@+id/title"
android:layout_height="50dip"
android:layout_width="fill_parent"
android:text="blah blah"
android:textColor="#ffffff"
android:textSize="18sp"
/>
<ListView
android:background="#ffffff"
android:cacheColorHint="#ffffffff"
android:id="@android:id/list"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
/>
</LinearLayout>
<LinearLayout
android:background="#efefef"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_width="fill_parent"
android:layout_height="50dip"
android:orientation="horizontal">
<Button
android:layout_height="wrap_content"
android:id="@+id/back"
android:text="Back"
android:layout_width="wrap_content" />
<Button
android:layout_height="wrap_content"
android:id="@+id/home"
android:text="Home"
android:layout_width="wrap_content" />
<Button
android:layout_height="wrap_content"
android:id="@+id/next"
android:text="Next"
android:layout_width="wrap_content" />
</LinearLayout>
</RelativeLayout>
Here comes a simple suggestion. Make a new XML and have a go with this.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView
android:text="Header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<TextView
android:text="Footer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"/>
</LinearLayout>