BaseRecyclerViewAdapterHelper
一个非常简单灵活且强大的adapter
GitHub:
https://github.com/CymChad/BaseRecyclerViewAdapterHelper
配套文档:
https://github.com/CymChad/BaseRecyclerViewAdapterHelper/blob/master/readme/1-BaseQuickAdapter.md
1. 导入
根目录build添加jitpack
allprojects {
repositories {
...
maven {
url 'https://jitpack.io' }
}
}
添加依赖
dependencies {
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.4'
}
2. 使用
1. 编写adapter
/**
* <pre>
* author : i m yours
* e-mail : onlyyoulove3@gmail.com
* time : 2020/08/23
* desc : 测试adapter
* version: 1.0
* </pre>
*/
class TestAdapter(var namelist: MutableList<String>) :
BaseQuickAdapter<String,BaseViewHolder>(R.layout.item_bluetooth,namelist) {
override fun convert(holder: BaseViewHolder, item: String) {
holder.setText(R.id.tv_bluetooth_name,item)
}
}
- R.layout.item_bluetooth:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<