How to set a dialog themed activity width to screen width? [duplicate]
I am followin the method described here to create an EditText input activity. But the view doesn't fill the width of the screen. How can I tell to fit the screen width?
alt text http://img405.imageshack.us/img405/5057/activitythemed.png
<activity android:name="TextEntryActivity"
android:label="My Activity"
android:theme="@android:style/Theme.Dialog"/>
-
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:orientation="vertical"
android:gravity="right"
android:layout_height="wrap_content">
<EditText
android:text="@+id/txtValue"
android:id="@+id/txtValue"
android:layout_width="fill_parent"
android:layout_height="wrap_content"></EditText>
<Button
android:text="Done"
android:id="@+id/btnDone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></Button>
</LinearLayout开发者_开发问答>
Set android:minWidth
and/or android:minHeight
in your LinearLayout.
Another option is to use AlertDialog instead Dialog.
The short answer is that you can't. A dialog is only meant to wrap it's content. If you want the content to fill the screen you should be using an activity
精彩评论