I am trying to show Android activity with:
- topic of dialogue;
- a title fixed at the top of the dialog box;
- a button bar located at the bottom of the dialog box;
- scroll in the middle.
The layout I wrote fulfills these criteria, except that the dialog always fills the full screen (see the vertical screenshot below).
This is my 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>
In addition, the activity has the @android:style/Theme.Dialog and android:windowNoTitle .
I'm not sure I understand why this layout is expanding to fill the entire screen. None of the views has a layout height set to fill_parent ; parent layout is not set to fill_parent .
Does anyone know if it is possible that I want to do, and if so, how to do it?
My current layout is horizontal

My current layout is vertical

source share