SKRecyclerViewAdapter
Make RecyclerView.Adapter simpler
Support MutilType Layout , Kotlin, Functional Programming
Dependency
Include the library in your build.gradle
1 | dependencies{ |
Github : https://github.com/lzdon/SKAdapter
Usage
- 定义数据类
1 | class Item1(val title: String, val subTitle: String) |
- 初始化
adpter
1 | private fun initView(view: View) { |
- 注入数据
1 | val result = arrayListOf<Any>() |
kotlin
只需上面三步,如果使用java
,需要实现SKViewHolder
和SKViewHolderFactory
1 | private void initView(View view) { |
More
- SKPlaceHolderAdapter - 支持空提示、错误占位图的Adapter
使用:
1 | val adapter = SKPlaceHolderAdapter() |
定制自己的空提示、错误布局:
1 | // global |
1 | // constructor injection |
- SKAutoPageAdapter - 支持自动分页加载的Adapter
1 | val adapter = SKAutoPageAdapter() |