0
A
回答
0
你不能用TableLayout
這樣做,它們只支持列跨度。但你可以用GridLayout
代替!嘗試是這樣的:
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnCount="2"
android:rowCount="2"
android:orientation="horizontal">
<Button
android:layout_column="0"
android:layout_row="0"
android:layout_columnSpan="2"
android:layout_rowSpan="2" />
...
</GridLayout>
要確定有多少行和列有對GridLayout
使用這兩個屬性:
android:columnCount
android:rowCount
你可以定義一個的位置的GridLayout
與這兩個屬性裏面:
android:layout_column
android:layout_row
而且你可以定義多少行或列的View
與這兩個屬性的跨越:
android:layout_rowSpan
android:layout_columnSpan
請注意,GridLayout
僅與API級別14加入!如果您想在早期版本中使用GridLayout
,則需要使用支持庫中的GridLayout
:
<android.support.v7.widget.GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
...
</android.support.v7.widget.GridLayout>
相關問題
- 1. 如何使第一行tablelayout佔用整個空間
- 2. 我如何防止表單控件在Bootstrap中佔據新行
- 3. 我如何使控件在javafx中佔據整個父空間?
- 4. TableLayout出現在另一個TableLayout
- 5. 把一個TableLayout放在一個ScrollView中?
- 6. 如何使tablelayout與同一寬度的行,在一行中包含兩個高度相同的單元格
- 7. 的Android TableLayout - 跨兩行
- 8. 我該如何製作兩個控件,每個都佔據父母面積的一半?
- 9. 如何在android中執行此tablelayout?
- 10. 如何在tablelayout中應用行跨度?
- 11. 如何使TabWidgets中的文本佔據兩行?
- 12. 如何將兩個孩子放入android的tablelayout中的一個單元格中?
- 13. 如何在asp.net中對兩個控件使用單一驗證
- 14. 如何使RequiredFieldValidator控件兩個驗證兩個控件
- 15. 錨定 - 讓兩個組件佔用面板的各佔一半
- 16. 將一個事件給任何tableLayout行上的任何按鈕?
- 17. 旁邊有兩個TD,其中一個佔據100%的寬度?
- 18. 如何在android中設置這個tableLayout?
- 19. 如何在TableLayout中找到100個EditTex
- 20. linearLayout裏面的兩個tableLayout
- 21. 如何在同一行中兩次讀取同一個文件
- 22. 如何在一個php文件中執行兩個javascripts?
- 23. 在Linux中,如何獨佔控制stdout?
- 24. Android TableLayout控件,具有統一的行/列大小
- 25. 我如何使宏在csv文件中佔第一行
- 26. 如何在TableLayout中垂直拉伸一行?
- 27. 如何創建一個4列的TableLayout?
- 28. 如何給下一個孩子tablelayout android
- 29. 如何從TableLayout刪除行?
- 30. 在HBase中佔用一行