HeaderFooterGridView
ICON
頭尾GridView,支持AUTO_FIT模式荒勇,頭尾模式有兩種,無反射代碼。
預(yù)覽
Screenshots
要求
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的子項(xiàng)position默辨,處理position時(shí)需要小心