Schwierigkeiten mit ScrollView und LinearLayout

Ich versuche, mich ein Android-layout: 3-Komponenten innerhalb einer vertikalen LinearLayout. Der center-Komponente wird ein ScrollView enthält eine TextView. Wenn die TextView enthält eine beträchtliche Menge an text (mehr als auf den Bildschirm passen), die ScrollView wächst den ganzen Weg um den unteren Rand des Bildschirms, zeigt Scrollbalken, und schiebt die Letzte Komponente, ein LinearLayout mit einem Button innen, die aus dem Bildschirm.

Wenn der text innerhalb der TextView innerhalb der ScrollView kurz genug ist, den Knopf an der Unterseite des Bildschirms positioniert ist, perfekt.

Das layout, das ich versuche zu erreichen ist:

Schwierigkeiten mit ScrollView und LinearLayout

Die XML-Datei für das layout, das ich geschrieben habe, ist:

<?xml version="1.0" encoding="UTF-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">

    <TextView android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="#FFFFFF"
            android:layout_marginLeft="10dip"
            android:layout_marginRight="10dip"
            android:layout_marginTop="10dip"
            android:layout_marginBottom="10dip"
            android:text="Title />

    <ScrollView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content">

        <TextView android:id="@+id/text"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:autoLink="web"
                android:textColor="#FFFFFF"
                android:background="#444444"
                android:padding="10dip" />

    </ScrollView>

    <LinearLayout
            android:orientation="horizontal"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1">

        <LinearLayout
                android:orientation="horizontal"
                android:layout_width="0dip"
                android:layout_height="wrap_content"
                android:layout_weight="1"/>

        <Button android:id="@+id/login_button"
                android:layout_width="0dip"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom"
                android:layout_weight="1"
                android:text="@string/next_button"/>

    </LinearLayout>

</LinearLayout>
InformationsquelleAutor poe | 2011-09-04
Schreibe einen Kommentar