tags:

views:

307

answers:

3

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

<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>
A: 

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

Erich Douglass
set to what?...
Pentium10
To "fill_parent", in the same way as android:layout_width
AaronM
That doesn't work out. error: Error: String types not allowed (at 'minWidth' with value 'fill_parent').
Pentium10
Sorry, didn't mean to be short with the answer. You can use those properties to force a minimum size, i.e android:minWidth="200dip" android:minHeight="400dip". You do have to specify the size absolutely, so "wrap_content" and "fill_parent" won't work.
Erich Douglass
+1  A: 

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

CaseyB
+1  A: 

You can do it quite easily, have a look here: http://stackoverflow.com/questions/2634850/android-dialog-width

fhucho