ListView obscuring sibling views?
I can't seem to get the footer navigation bar to show up in this layout. It's obscured by the ListView no matter how I set layout_weight on the navigation bar or change the layout_height of the ListView to one of FILL_PARENT or WRAP_CONTENT. Any ideas how to get the correct result? Essentially, I want the footer to be fixed at the bottom of the screen.
(BTW, I need to keep the nested LinearLayouts. However, I can change them to other ViewGroups.)
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<ListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
<include layout="@layout/wizard_navbar_last" />
</LinearLayout>
</LinearLayout>
Update: and I should point out that I'm actually adding the ListView via code like so:
ViewGroup page3 = (ViewGroup)
findViewById(R.id.wizard_page3_container); //parent linearlayout
page3 = (ViewGroup) page3.getChildAt(0); //linearlayout
LayoutInflater inflater=
(LayoutInflater) LayoutInflater.from(getApplicationContext());
folderList = (ListView) inflater.inflate(R.layout.wizard_dropbox_list,
null);
page3.addView(folderList, 0);
Update2: the XML for the navbar:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/wizard_navbar_last"
android:paddingTop="20dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<include
layout="@layout/wizard_previous_button"/>
<View
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
<Button
android:id="@+id/wizard_finish"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Done"
android:textSize="20dp"/>
</Linear开发者_StackOverflowLayout>
And previous_button is ... you guessed it, just a button. As for wizard_dropbox_list, it's the ListView as shown here.
Try wrapping the Listview and Navbar in a RelativeLayout
. Set the ListView to alignParentTop="true"
and layout_height="wrap_content"
, and set the NavBar to alignParentBottom="true"
and layout_height="wrap_conent"
. That should give you the effect you're looking for.
精彩评论