2012-07-17 50 views

回答

5

裹。這將導致細胞有一個有兩個孩子的孩子。

<TableRow 
      android:id="@+id/tableRow2" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" > 

      <RelativeLayout 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" > 
       <Button 
       android:id="@+id/button3" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Button" /> 

      <Button 
       android:id="@+id/button4" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Button" /> 
      </RelativeLayout> 

     </TableRow> 
1

只需將兩個View s合併爲一個LinearLayout並使其成爲該單元格。

所以層次結構是這樣的:

- table 
    - row 
    - view 
    - view 
    - layout 
     - child view 
     - child view 
    - view 
    - row 
    ... 

然後,兩個孩子將顯示爲一個小區(在我的例子以上,4個細胞的第3次)。

1

呀,你可以在兩個孩子的佈局將它們包裝在LinearLayout

相關問題