Stretching across 2 rows in Table Layout

Posted by Will03uk on Stack Overflow See other posts from Stack Overflow or by Will03uk
Published on 2010-12-22T11:41:55Z Indexed on 2010/12/22 11:54 UTC
Read the original article Hit count: 195

Filed under:
|
|

How do I stretch across 2 columns in the Table Layout. I have 2 rows with a label and edit text on 1 row and I want to have a single button stretch across the whole second row.

<?xml version="1.0" encoding="utf-8"?>
<TableLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="fill_parent" 
    android:layout_width="fill_parent"
    android:background="#000000"
    android:stretchColumns="1">

    <TableRow>
        <TextView
            android:text = "Name: "
        />
        <EditText
            android:id = "@+id/txtAddName"
            android:gravity = "right"
            android:layout_width = "fill_parent"
        />
    </TableRow>
    <TableRow>
        <TextView
            android:text = "Phone: "
        />
        <EditText
            android:id = "@+id/txtAddPhone"
            android:gravity = "right"
            android:layout_width = "fill_parent"
        />        
    </TableRow>
    <TableRow>
        <Button
            android:id = "@+id/btnAdd"
            android:text = "Add Entrie"
            android:layout_width = "fill_parent"
        />
    </TableRow>
    <TableRow>
        <Button
            android:id = "@+id/btnShow"
            android:text = "Show all Entries"
            android:layout_width = "fill_parent"
        />
    </TableRow>
    <TableRow>
        <Button
            android:id = "@+id/btnDelete"
            android:text = "Delete all Entries"
            android:layout_width = "fill_parent"
        />
    </TableRow>
</TableLayout>

© Stack Overflow or respective owner

Related posts about android

Related posts about Xml