2

xml で定義されたいくつかの TableRows を持つ TableLayout があります。すべての行の重みは 1 ですが、最初の行の重みは 0 で、高さは次のように「wrap_content」として定義されています。

<TableRow 
        android:layout_weight="0" 
        android:layout_height="wrap_content"
        android:id="@+id/row">
      <Button
         android:id="@+id/tbl_txt1"
         android:layout_width="0dip"
         android:layout_height="wrap_content"
         android:layout_weight="1"
         android:textAppearance="@android:style/TextAppearance.DeviceDefault.Small"
         android:gravity="center"/>

      <Button
         android:id="@+id/tbl_txt2"
         android:layout_width="0dip"
         android:layout_height="wrap_content"
         android:layout_weight="1"
         android:textAppearance="@android:style/TextAppearance.DeviceDefault.Small"
         android:gravity="center"/>
</TableRow>

問題は、Android 2.3 を搭載したデバイスでは正常に動作する (ボタンのコンテンツをラップする) ことですが、Android 4 (ics) を搭載したデバイスでは何もラップしない (高さが固定されている) ことです。fill_parent を試しましたが、結果は同じです。

4

0 に答える 0