HeaderFooterGridView
头尾GridView,支持AUTO_FIT模式,头尾模式有两种,无反射代码。
预览
要求
minSdkVersion 4
链接
使用
- 基本布局
<am.widget.headerfootergridview.HeaderFooterGridView
android:id="@+id/gird_hfg_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnWidth="64dp"
android:gravity="center"
android:horizontalSpacing="10dip"
android:numColumns="auto_fit"
android:stretchMode="columnWidth"
android:verticalSpacing="10dip" />
- 基本代码
HeaderFooterGridView hfgContent = (HeaderFooterGridView) findViewById(id);
hfgContent.addHeaderView(headerView);
hfgContent.removeHeaderView(headerView);
hfgContent.addHeaderItem(headerItem);
hfgContent.removeHeaderItem(headerItem);
hfgContent.addHeaderItem(headerItem, null, true);
hfgContent.addFooterItem(footerItem);
hfgContent.removeFooterItem(footerItem);
hfgContent.addFooterItem(footerItem, null, true);
hfgContent.addFooterView(footerView);
hfgContent.removeFooterView(footerView);
注意
- 空白站位View占用GridView的子项position,处理position时需要小心
这篇博客介绍了HeaderFooterGridView,一个支持头尾模式且包含AUTO_FIT模式的组件。内容包括预览、要求、链接到源码的平台以及使用示例,特别提醒在处理位置时要注意空白站位View。

被折叠的 条评论
为什么被折叠?



