Растяжение по 2 рядам в макете таблицы - PullRequest
0 голосов
/ 22 декабря 2010

Как мне растянуть две колонки в TableLayout. У меня есть 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 Ответ

1 голос
/ 22 декабря 2010

посмотрите здесь пример: http://www.droidnova.com/tablelayout-supports-column-span,105.html

...