0

次のようなレイアウトを作成したい:

ここに画像の説明を入力

TableLayoutアクティビティ レイアウトに次のものがあります。

        <TableLayout
            android:id="@+id/table"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:stretchColumns="1" >
        </TableLayout>

TableRow次に、このレイアウトでa を膨らませます。

<?xml version="1.0" encoding="utf-8"?>
<TableRow xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/tablerow"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >

    <TextView
        android:id="@+id/name"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_column="0"
        android:layout_weight="1"
        android:text="name" />

    <TextView
        android:id="@+id/value"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_column="1"
        android:layout_weight="1"
        android:text="value" />

</TableRow>

そして、それをに追加しTableLayoutます。stretchColumns0 または 1 に設定しようとしましたが、別のlayout_width値を使用しましたが、役に立ちませんでした。すべての最初の列をすべて、TableRows最も広い TextView と同じくらい広くする必要があります。

4

1 に答える 1