HeaderFooterGridView-头尾GridView

HeaderFooterGridView

ICON

头尾GridView,支持AUTO_FIT模式,头尾模式有两种,无反射代码。

预览

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的子项position,处理position时需要小心
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容