Android-unten-Taste, bar & scroll-view mit dialog-Thema

Ich versuche, das display eines Android-Aktivität mit:

  • ein Dialogfeld, in das Thema;
  • einen Titel fest an der Spitze der dialog;
  • eine button-Leiste fest am unteren Rand des Dialogfelds;
  • einer scroll-view in der Mitte.

Dem layout, das ich geschrieben habe, erfüllt diese Kriterien, mit der Ausnahme, dass der dialog immer füllt den ganzen Bildschirm (siehe vertikale screenshot unten).

Dies ist mein layout:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="wrap_content">

    <TextView android:id="@+id/header"
    android:layout_width="fill_parent" android:layout_height="wrap_content"
    android:layout_marginLeft="10dp" android:layout_marginRight="10dp"
    android:layout_marginTop="10dp" android:layout_marginBottom="10dp"
    android:gravity="center_vertical"
        android:textSize="18dip" android:textColor="#ffffff"
        android:text="Sample Layout" />

    <LinearLayout android:id="@+id/controls" android:orientation="horizontal"
    android:layout_width="fill_parent" android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    style="@android:style/ButtonBar">
        <Button android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:layout_weight="1" android:text="Yes" />
        <Button android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:layout_weight="1" android:text="No" />
    </LinearLayout>

    <ScrollView android:id="@+id/test" android:layout_below="@id/header"
    android:layout_above="@id/controls"
    android:layout_width="fill_parent" android:layout_height="wrap_content"
    android:layout_marginBottom="5dp" android:layout_marginLeft="5dp"
    android:layout_marginRight="5dp">
        <TextView android:layout_width="fill_parent" android:layout_height="wrap_content"
        android:text="Lorem ipsum dolor sit amet, consectetur
        adipiscing elit. Integer dui odio, convallis vitae suscipit eu,
        tincidunt non mi. Vestibulum faucibus pretium purus vel adipiscing.
        Morbi mattis molestie risus vitae vehicula. [...]" />
    </ScrollView>

</RelativeLayout>

Darüber hinaus die Aktivität ist gestaltet mit @android:style/Theme.Dialog und android:windowNoTitle.

Ich bin mir nicht sicher, ob ich verstehe, warum dieses layout erweitert, um den gesamten Bildschirm auszufüllen. Keine der Ansichten in einem layout-Höhe eingestellt fill_parent; das übergeordnete layout nicht fill_parent entweder.

Weiß jemand, ob das, was ich will zu tun, ist möglich, und wenn ja, wie tun Sie es?

Meine aktuelle layout im horizontalen Modus

Android-unten-Taste, bar & scroll-view mit dialog-Thema

Meinem aktuellen layout in den vertikalen Modus

Android-unten-Taste, bar & scroll-view mit dialog-Thema

InformationsquelleAutor Alpha Hydrae | 2011-03-11
Schreibe einen Kommentar