views:

220

answers:

1

i have using Table Layout. It has two columns. first column contains a text view another one is EditText. My Layout should be look like this.

column1: columnvalue1
column2: columnvalue2
col3: columnvalue3

But my Layout auto aligned like this:

column1: columnvalue1
column2: columnvalue2
col3:    columnvalue3

how to resolve the layout like first one. what is the mistake in it.Any idea?

code: i noted single row's code. for reference. like this code i done for all rows.

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="wrap_content" android:layout_height="fill_parent"
            android:stretchColumns="1" android:background="@drawable/corner_white"
            android:layout_margin="10dip">
<TableRow android:orientation="horizontal"
                android:minHeight="50dip" android:gravity="center_vertical">
                <TextView android:text="@string/ename" android:textSize="15sp"
                    android:textColor="@color/black" android:padding="10dip" />
                <EditText android:id="@+id/ename_value" android:textSize="15sp"
                    android:inputType="textEmailAddress" android:background="@null"
                    android:singleLine="true" />
            </TableRow>
        </TableLayout>
+2  A: 

There's no mistake, that's exactly what a TableLayout is meant to do. If you don't want the columns to have the same width, take the third row out of the table and put it into its own horizontal LinearLayout.

(And, by the way, you've got yourself mixed up between columns and rows in your examples. It should say:

row1: row1 value
row2: row2 value
r3: row3 value
Steve H