-1

画面の幅いっぱいに表示される 4 つの列を持つテーブルを作成したいと考えています。ユーザー入力に応じて変化するテキストを入力します。表の 4 つの列の幅を、どのテキストを入力しても同じ幅に保ちたいのですが、どうすればよいでしょうか?

4

2 に答える 2

1

layout_width="0dip"すべての列でandを使用しlayout_weight="1"ます。

于 2013-05-13T11:03:19.433 に答える
0

次のようなテーブル レイアウトを作成できます。

    <TableLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:stretchColumns="*" >

    <TableRow
        android:id="@+id/tableRow1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1" >

        <TextView
            android:id="@+id/editText2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:ems="10"
            android:longClickable="false"
            android:text="sdf" />

        <TextView
            android:id="@+id/editText4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:ems="10"
            android:text="sdfasdfsdfsdf" />

        <TextView
            android:id="@+id/editText3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:ems="10"
            android:text="sdsd" />

        <TextView
            android:id="@+id/editText1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:ems="10"
            android:text="asdfasdfasdfasf" />

    </TableRow>
</TableLayout>

固定サイズ

于 2013-05-13T11:06:40.500 に答える