8

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>
Community
  • 1
  • 1
Pentium10
  • 204,586
  • 122
  • 423
  • 502
  • 1
    I doubt if it's a duplicate. This question is about Dialog themed Activity which is not same as a dialog. – jimmy0251 Nov 05 '14 at 19:30

3 Answers3

1

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

Erich Douglass
  • 51,744
  • 11
  • 75
  • 60
  • To "fill_parent", in the same way as android:layout_width – AaronM Jun 02 '10 at 21:52
  • That doesn't work out. error: Error: String types not allowed (at 'minWidth' with value 'fill_parent'). – Pentium10 Jun 02 '10 at 21:56
  • 1
    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 Jun 03 '10 at 00:46
1

Another option is to use AlertDialog instead Dialog.

cdmckay
  • 31,832
  • 25
  • 83
  • 114
0

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

Pentium10
  • 204,586
  • 122
  • 423
  • 502
CaseyB
  • 24,780
  • 14
  • 77
  • 112