Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set a dialog themed activity width to screen width? [duplicate]

Tags:

android

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>
like image 986
Pentium10 Avatar asked Jun 02 '10 21:06

Pentium10


2 Answers

Set android:minWidth and/or android:minHeight in your LinearLayout.

like image 122
Erich Douglass Avatar answered Nov 15 '22 01:11

Erich Douglass


Another option is to use AlertDialog instead Dialog.

like image 45
cdmckay Avatar answered Nov 14 '22 23:11

cdmckay