大家好,我又来了。这次推荐一套我自己开发的列表速构adapter类库(当然我也是站在巨人的肩膀上行走)。类库具体详情请看项目主页。
1. 特点
(1)基于模板,可以媲美市面上任何现有的adapter类库
(2)优雅流畅的API调用方式,让你使用adapter时代码量尽可能少。
(3)全面支持GridView ,ListView, RecyclerView 和 ExpandableListView
(4)极易使用容易修改和扩展
2. 使用范例
(1)gradle依赖
compile 'com.github.thepacific:adapter:1.0.3'
(2)RecyclerView , ListView , GrideView
继承和扩展相应的adapter基类(RecyclerAdapte用于RecyclerView ,Adapter用于ListView,GridView),然后重写adapter类的convert方法即可。具体代码如下图:
(3)ExpandableListView
继承和扩展相应的adapter基类(ExpandableAdapter用于ExpandableListView),然后重写adapter类的getChildren、convertGroupView、convertChildView方法即可。具体代码如下图:
3. 注意
(1)在convert方法里面暂时不要通过 helper.getItemView().setTag()给设置item view的tag值,因为该值已经设置引用了helper对象。如需使用tag存储某些值,请使用item view的子view的tag来实现。
转载请注明出处:http://www.jianshu.com/p/f18f77255952
速构adapter项目主页:https://github.com/ThePacific/adapter
文/UsherBaby(简书作者)
原文链接:http://www.jianshu.com/p/f18f77255952
著作权归作者所有,转载请联系作者获得授权,并标注“简书作者”。