0

XML ファイルに次の設定があります。

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/table_more_features"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@color/background_blue" >
    ...
<TableRow
        android:id="@+id/tableRow7"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@drawable/cell_top"
        android:padding="5dip" >

        <TextView
            android:id="@+id/txt_foo"
            android:background="@android:color/transparent"
            android:layout_weight=".3"
            android:text="Foo" />

        <TextView
            android:id="@+id/txt_bar"
            android:background="@android:color/transparent"
            android:layout_weight=".3"
            android:text="Bar" />

        <TextView
            android:id="@+id/txt_woo"
            android:background="@android:color/transparent"
            android:layout_weight=".3"
            android:text="Woo" />
    </TableRow>
...
</TableLayout>

結果は次のようになりますこれ

私が何をしようとしても、3 つの TextView の間に均等な間隔を確保できないようです。最初のものが常に部屋の大部分を占めます。3つすべてを水平方向に均等に配置しようとしています。

助けてくれてありがとう。

4

1 に答える 1

1

私のASでは、コードのスペースが均等に広がっていますが、次のことを試すことができます:

  • 各 TextView に追加android:layout_width="0dp"
  • (オプション) 表の行に追加android:weightSum="1"
于 2013-08-12T18:25:48.630 に答える