2011-09-11 8 views

答えて

2

一つのアプローチはandroid:layout_weight="1"で、LinearLayoutを使用することです:

<LinearLayout 
    android:layout_height="wrap_content" 
    android:layout_width="match_parent" 
    android:orientation="horizontal"> 
    <Button 
     android:text="Button 1" 
     android:layout_height="wrap_content" 
     android:layout_width="0dp" 
     android:layout_weight="1" /> 
    <Button 
     android:text="Button 2" 
     android:layout_height="wrap_content" 
     android:layout_width="0dp" 
     android:layout_weight="1" /> 
    <Button 
     android:text="Button 3" 
     android:layout_height="wrap_content" 
     android:layout_width="0dp" 
     android:layout_weight="1" /> 
</LinearLayout> 
1

TableLayout:3列2行、stretchModeをspacingWidthUniformとすることができます。

編集:試していないが、これはうまくいくはずだ。

<TableLayout android:id="@+id/TableLayout01" 
     android:layout_height="wrap_content" android:layout_width="fill_parent" android:stretchMode="spacingWidthUniform"> 
     <TableRow android:id="@+id/TableRow01" android:layout_width="fill_parent" 
      android:layout_height="wrap_content"> 
      <Button android:layout_width="wrap_content" 
       android:layout_height="wrap_content" android:text="Settings" 
       android:id="@+id/btnSettings"></Button> 
      <Button android:text="@+id/Button01" android:id="@+id/Button01" 
       android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> 
      <Button android:text="@+id/Button02" android:id="@+id/Button02" 
       android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> 
     </TableRow> 
     <TableRow android:id="@+id/TableRow02" android:layout_width="fill_parent" 
      android:layout_height="wrap_content"> 
      <Button android:text="@+id/Button03" android:id="@+id/Button03" 
       android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> 
      <Button android:text="@+id/Button04" android:id="@+id/Button04" 
       android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> 
      <Button android:text="@+id/Button05" android:id="@+id/Button05" 
       android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> 
     </TableRow> 
    </TableLayout> 
関連する問題