在表格布局中拉伸2行

时间:2010-12-22 11:41:56

标签: android xml android-layout tablelayout android-tablelayout

如何在TableLayout中的2列中展开。我有2行标签和1行编辑文本,我希望在整个第二行有一个按钮伸展。

<?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>

1 个答案:

答案 0 :(得分:1)