【Andoid学习】GridView学习

简介

一个在平面上可显示多个条目的可滚动的视图组件,该组件中的条目通过一个ListAdapter和该组件进行关联。
比如实现九宫格图,用GridView是首选,也是最简单的。

属性:
android:columnWidth  
设置列的宽度。关联的方法为:setColumnWidth(int)

android:gravity   
设置此组件中的内容在组件中的位置。
必须是一个或多个(用“|”分隔开)以下的常量。
top、bottom、left、right、center_vertical、fill_vertical、center_horizontal、fill_horizontal、center、fill
关联方法:setGravity (int gravity)

android:horizontalSpacing  
两列之间的间距。关联方法:setHorizontalSpacing(int)

android:numColumns  
列数。关联方法:setNumColumns(int)
可以是auto_fit常量,表示尽可能多的显示列来填补的可用空间。

android:stretchMode
缩放模式。关联方法:setStretchMode(int)

原文地址:https://www.cnblogs.com/six-moon/p/4673692.html