У меня есть следующие настройки, чтобы получить макет с верхним и нижним колонтитулом. Поскольку активность отображается в диалоговом окне, я хочу установить высоту верхнего элемента на «wrap_content». Что касается документов Android, это невозможно, если вы устанавливаете alignParentBottm = "true" для дочернего элемента.
В другом вопросе кто-то предложил использовать LinearLayout и установить maxHeight программно. Есть ли другие способы избежать alignParentBottom = "true"?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/LNL_TOP"
android:layout_width="match_parent"
android:layout_height="60dip"
android:layout_alignParentTop="true">
</LinearLayout>
<LinearLayout
android:id="@+id/LNL_BOTTOM"
android:layout_width="match_parent"
android:layout_height="60dip"
android:layout_alignParentBottom="true">
</LinearLayout>
<LinearLayout
android:id="@+id/LNL_CONTENT"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/LNL_TOP"
android:layout_above="@+id/LNL_BOTTOM">
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</RelativeLayout>
Вот изображение того, как оно в данный момент выглядит, я хочу, чтобы макет обернул содержимое и избежал пустого места под списком.
