I have a dialog with this content:
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginBottom="25dp" >
<LinearLayout
...
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/closebtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/scrollview"
android:layout_centerHorizontal="true" />
</RelativeLayout>
I want the dialog to be sized vertically to fit as much of the content of the LinearLayout as it can. However, I'm finding that, if the contents of the LinearLayout are too tall, the ScrollView fills the dialog and the close button gets pushed past the bottom and is not visible.
One thing I tried was to make the Button layout_alignParentBottom="true" and make the ScrollView layout_above="@+id/closebtn", but then the dialog always stretches to fill the whole screen vertically, even if the content of the LinearLayout is really short.