Neo
Neo

Reputation: 1

How can I stretch EditText views in Android?

This is my layout XML file:

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
             android:layout_width="fill_parent"
             android:layout_height="fill_parent">
    <TableRow android:layout_width="wrap_content"
              android:layout_height="wrap_content">
        <TextView android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="One"/>
        <EditText android:layout_width="wrap_content"
                  android:layout_height="wrap_content"/>
    </TableRow>    
    <TableRow android:layout_width="fill_parent"
              android:layout_height="wrap_content">
        <TextView android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="Two"/>
        <EditText android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:inputType="numberSigned"/>
    </TableRow>
</TableLayout>

The problem, however, is that EditText views are ridiculously small - as small as possible I reckon. Is there a way to make them as wide as possible?

Upvotes: 0

Views: 3653

Answers (2)

Jonathan Roth
Jonathan Roth

Reputation: 1271

make the second column of your tablelayout stretchable:

android:stretchColumns="1"

Hope this works

Upvotes: 3

Thizzer
Thizzer

Reputation: 16653

Make their width fill_parent

<EditText android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:inputType="numberSigned"/>

Upvotes: 0

Related Questions