кнопки под расширением scrollview

Макет, который я пытаюсь реализовать, (я думаю) довольно прост.

One TextView расширяется в зависимости от того, что находится внутри. Чуть ниже находятся две кнопки (OK / Отмена).

Я могу заставить кнопки прилипать к нижней части экрана, и это отлично работает. Но я бы хотел, чтобы эти кнопки были чуть ниже TextView. Я пробовал много разных вещей, но вот мой последний макет:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
        >
    <ScrollView android:id="@+id/Scroll"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
            >
        <TextView
                android:id="@+id/Text"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                />
    </ScrollView>
    <RelativeLayout android:id="@+id/buttons"
                    android:layout_height="fill_parent"
                    android:layout_width="fill_parent"
                    android:layout_below="@+id/Scroll"
                    android:layout_above="@+id/bottom"
            >
        <LinearLayout
                android:orientation="horizontal"
                android:layout_height="wrap_content"
                android:layout_width="fill_parent">
            <Button android:id="@+id/ButtonOK"
                    android:layout_height="80dp"
                    android:layout_width="fill_parent"
                    android:text="OK"
                    android:layout_weight="1"/>
            <Button android:id="@+id/ButtonCancel"
                    android:layout_height="80dp"
                    android:layout_width="fill_parent"
                    android:text="Cancel"
                    android:layout_weight="1"/>
        </LinearLayout>
    </RelativeLayout>
    <LinearLayout android:id="@+id/bottom"
                  android:layout_height="0px"
                  android:layout_width="fill_parent"
                  android:layout_alignParentBottom="true"/>
</RelativeLayout>

Пустой линейный макет в конце - это (безуспешная) попытка предотвратить выход вида за нижнюю часть экрана ...

В все, что я пробовал, либо кнопки находятся внизу экрана, либо они пройдут мимо, когда TextView слишком велик.

Вот набросок того, что я пытаюсь сделать: enter image description here

16
задан Matthieu 19 May 2011 в 22:44
поделиться