GridView getChildCount

来源:互联网 发布:机械常最用有限元软件 编辑:程序博客网 时间:2024/05/21 06:36

GridView.getCount()(实际上是 AdapterView.getCount()) 返回的是其 Adapter.getCount() 返回的值。也就是“所包含的 Item 总个数”。

    GridView.getChildCount()(ViewGroup.getChildCount) 返回的是显示层面上的“所包含的子 View 个数”。

其中 getChildCount() 返回的是当前可见的 Item 个数




多行多列网状形式的优先使用GridView
android:numColumns="auto_fit" --------列数设置为自动
android:columnWidth="90dp",----------每列的宽度,也就是Item的宽度
android:stretchMode="columnWidth"------缩放与列宽大小同步
android:verticalSpacing="10dp"----------垂直边距
android:horizontalSpacing="10dp"-------水平边距

0 0