EditText in the table. How to fix 100%

I have a linearlayout with a table and button, the table has EditText and TextView, my problem is with EditText, which is too small.

  <LinearLayout
        android:orientation="vertical"
        android:layout_width="300dip"
        android:layout_height="350dip"
        android:background="@drawable/background_resto"
    >

        <LinearLayout               
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:gravity="center"
            >

        <TableLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            >
            <TableRow
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:gravity ="center"
            >
                <TextView
                    android:id="@+id/nameRegister"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:textColor="#000000"
                    android:text="Nombre"
                    android:layout_marginLeft="10dip" 
                    />
            </TableRow>

            <TableRow
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:gravity ="center"   
            >

                <EditText
                    android:id="@+id/registerName"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:singleLine="true"
                    android:layout_marginLeft="10dip"
                    android:layout_marginRight="10dip" 
                    />
            </TableRow>


        </TableLayout>
             <Button
                android:id="@+id/butRegister"
                android:layout_height="35dip"
                android:layout_width="wrap_content"
                android:text="Enviar"
                />
        </LinearLayout>
        </LinearLayout>

I would like EditText to capture 300dip, which is the first linearLayout, but I don’t understand it, what should I do?

Thank you in advance

+3
source share
1 answer

Try this, add TableLayout stretchColumnsparam

<TableLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:stretchColumns="1"
            >
+6
source

All Articles