ListView скрывает родственные взгляды? - PullRequest
0 голосов
/ 27 сентября 2011

Не получается, чтобы в этом макете отображалась панель навигации нижнего колонтитула. ListView скрывает его независимо от того, как я установил layout_weight на панели навигации или , изменив layout_height объекта ListView на FILL_PARENT или WRAP_CONTENT. Есть идеи, как получить правильный результат? По сути, я хочу, чтобы нижний колонтитул был зафиксирован в нижней части экрана.

(Кстати, мне нужно сохранить вложенные LinearLayouts. Однако я могу изменить их на другие 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>

Обновление: и я должен указать, что я на самом деле добавляю ListView с помощью кода следующим образом:

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);

Обновление2: XML для панели навигации:

<?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"/>
  </LinearLayout>

И предыдущая кнопка ... вы уже догадались, просто кнопка. Что касается wizard_dropbox_list, это ListView, как показано здесь.

1 Ответ

0 голосов
/ 28 сентября 2011

Попробуйте обернуть Listview и Navbar в RelativeLayout.Установите для ListView значение alignParentTop="true" и layout_height="wrap_content", а для NavBar - значение alignParentBottom="true" и layout_height="wrap_conent".Это должно дать вам эффект, который вы ищете.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...