Я пытаюсь создать экран Android с привязкой TableLayout к вершине, затем прокруткой для заполнения середины и TableLayout с привязкой к нижней части.Я использовал RelativeLayout с alignParentTop / alignParentBottom, и отображается нижний TableLayout, но верхний исчезает.
Можно ли закрепить отдельные секции наверху и внизу с прокручиваемой областью, заполняющей середину?Представьте панель кнопок сверху и снизу с прокручиваемыми элементами посередине.Вот мой макет, который был близок, но не совсем работает.Я также пытался использовать TableLayout и 3 строки, в средней из которых было установлено fill_parent и ScrollView, но не смог заставить это работать.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LinearLayout01"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableLayout
android:id="@+id/CategoryTable01"
android:stretchColumns="*"
android:background="#000000"
android:layout_height="80px"
android:layout_alignParentTop="true"
android:layout_width="fill_parent">
<TableRow
android:id="@+id/tr01"
android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:padding="10px"
android:layout_gravity="center_vertical|center_horizontal">
<TextView android:text="TOP1" android:textColor="#0000FF" android:layout_height="fill_parent" android:layout_gravity="fill_vertical" android:textStyle="bold" />
<TextView android:text="TOP2" android:textColor="#CCCCCC" android:layout_height="fill_parent" android:layout_gravity="fill_vertical" android:textStyle="bold" />
</TableRow>
</TableLayout>
<ScrollView android:id="@+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LinearLayout02"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableLayout
android:id="@+id/TableLayout01"
android:stretchColumns="*"
android:background="@drawable/gradient"
android:layout_height="wrap_content"
android:paddingLeft="20px"
android:layout_width="fill_parent">
<TableRow
android:id="@+id/TableRow01"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical|center_horizontal">
<TextView android:textColor="#FFFFFF"
android:textStyle="bold"
android:textSize="12dip"
android:text="Sample Line 1"></TextView>
</TableRow>
<TableRow
android:id="@+id/TableRow02"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical|center_horizontal">
<TextView android:textColor="#FFFFFF"
android:textSize="11dip"
android:text="Sample Line 2"></TextView>
</TableRow>
<TableRow
android:id="@+id/TableRow03"
android:layout_height="600px"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical|center_horizontal">
<TextView android:textColor="#FFFF00"
android:textSize="11dip"
android:text="Sample Line 3"></TextView>
</TableRow>
</TableLayout>
</LinearLayout>
</ScrollView>
<TableLayout
android:id="@+id/CategoryTable02"
android:stretchColumns="*"
android:background="#000000"
android:layout_height="80px"
android:layout_alignParentBottom="true"
android:layout_width="fill_parent">
<TableRow
android:id="@+id/tr02"
android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:padding="10px"
android:layout_gravity="center_vertical|center_horizontal">
<TextView android:text="ONE" android:textColor="#0000FF" android:layout_height="fill_parent" android:layout_gravity="fill_vertical" android:textStyle="bold" />
<TextView android:text="TWO" android:textColor="#CCCCCC" android:layout_height="fill_parent" android:layout_gravity="fill_vertical" android:textStyle="bold" />
<TextView android:text="THREE" android:textColor="#CCCCCC" android:layout_height="fill_parent" android:layout_gravity="fill_vertical" android:textStyle="bold" />
<TextView android:text="FOUR" android:textColor="#CCCCCC" android:layout_height="fill_parent" android:layout_gravity="fill_vertical" android:textStyle="bold" />
</TableRow>
</TableLayout>
</RelativeLayout>
Спасибо за любые предложения или помощь.
Michael