I'm learning about Android dialogs and I'm confused about what determines their height. If I use this XML for my dialog 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">
<Button
android:id="@+id/AButton"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="10px"
android:text="Click Me to Dismiss"
/>
<TextView android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_toLeftOf="@id/AButton"
android:text="Click this button: "
/>
<ImageView
android:id="@+id/an_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="42px"
android:src="@drawable/screw50">
</ImageView>
/>
I get this dialog . . .
But Developer.Android.com says that...
"WRAP_CONTENT, which means that the view wants to be just big enough to enclose its content (plus padding)"
... so why is the dialog so much higher than it needs to be?
If I replace the layout height with
android:layout_height="200px"
it makes a properly short dialog but I don't want to use explicit pixel heights (it's not good practice). How do I make the dialog be just big enough for its content?