1

TableRow内に TextView があります。この TextView に FILL_PARENT 幅を設定する方法はありますか?

編集: TableRow に backgroundImage がある場合、塗りつぶされません

<TableLayout android:id="@+id/tableLayout1"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <TableRow android:layout_height="wrap_content" android:id="@+id/tableRow1"
        android:layout_width="fill_parent" android:background="@drawable/myImage">
        <TextView android:text="I wrapped!" android:id="@+id/textView1"
            android:layout_width="fill_parent" android:background="@color/white"
            android:layout_height="wrap_content"></TextView>
    </TableRow>
</TableLayout>
4

1 に答える 1

1

あなたのリンクはあなたの質問に答えます。

TableRow の子は、XML ファイルで layout_width および layout_height 属性を指定する必要はありません。TableRow は常にこれらの値をそれぞれ MATCH_PARENT と WRAP_CONTENT に強制します。

FILL_PARENT( MATCH_PARENTAPI レベル 8 以降で名前が変更されました)

あなたTextViewは自動的に でFILL_PARENTある必要がありMATCH_PARENTます。

于 2011-06-24T19:03:19.087 に答える