the simpler version of RecyclerView.Adapter in Android
implementation 'ca.six.oneadapter:oneadapter:1.0.1'
val data = (1..20).map { "ReccylerView Item $it" }
rvSimple.layoutManager = LinearLayoutManager(this)
val adapter = object : OneAdapter<String>(R.layout.item_rv_one, data) {
override fun apply(vh: RvViewHolder, value: String, position: Int) {
vh.setText(R.id.tv_rv_item, value)
}
}
rvSimple.setAdapter(adapter)
- The usage of MultiAdapter is more like RecyclerView. It still using render() to render each item.
- The usage of BuilderAdapter is more like ScrollView. It can
add(item)
to to add one child to it.MultiAdapter