1 GridLayout(网格布局) 在Android4.0开始引入。
GridLayout可以把布局分为几行和几列。
GridLayout可以设置一个组件横框多少行,纵夸多少列。
GridLayout和TableLayout很相似,但是如果要设计行列布局,GridLayout使用更方便、更高效。因为:
GridLayout
works with a flat-view hierarchy, where child views set their locations in the grid by specifying the rows and columns they should be in. By maintaining a flat hierarchy, GridLayout is able to more swiftly layout its child views.
The new GridLayout control for Android 4.0 is very powerful and we've just scratched the surface of what it can do
2 GridLayout常见属性
GridLayout常用的XML属性和方法说明
XML属性 | 相关方法 | 说明 |
---|---|---|
android:alignmentMode | setAlignmentMode(int) | 设置该布局管理器采用的对齐模式 |
android:rowCount
|
setRowCount(int)
|
设置该网格的行数
|