I'm trying to create a basic AlertDialog using an activity with a theme of Theme.Dialog. However, I'm having an issue with the size of the dialog. My XML is currently this:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TableRow>
<View
android:background="@drawable/divider_gradient"
android:layout_width="fill_parent"
android:layout_height="1dip" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dip" />
</TableRow>
</TableLayout>
</LinearLayout>
What I want is for there to be a horizontal bar between the title and the message. However, the bar is not being resized correctly. Rather than being the width of the activity, the bar is the width of the message text. This means that if the activity is being expanded by the message, then the bar will fill the whole activity, so it looks correct. However, if the message width is less than the activity width, the bar only displays above the part of the activity with the text. I've tried every single combination of "fill_parent" and "wrap_content" that I can think of, and none of those work.
I've also tried using RelativeLayout and placing the bar above the message text, but that also doesn't work. If I use the RelativeLayout approach and set the bar to fill_parent, it causes the activity to expand to fill the whole screen width, which is also undesirable. Ideally, I want the text placed, the activity width computed, and the bar resized to that width (without affecting it). Is there some way to flag a view to fill the parent view but not to affect its size? Thanks.