几乎每个app都离不开列表界面,实现的方式也是各种五花八门,随着技术的日新月异,各种相关的控件封装的也越来越彻底,功能越来越强大,本文则详细记录了时下最火的万能适配器BaseQuickAdapter、刷新控件SmartRefreshLayout搭配Recyclerview实现列表的步骤。
国际惯例,先看效果图:

1.首先我们引入各类依赖
打开build.gradle
//recyclerview
implementation 'androidx.recyclerview:recyclerview:1.0.0'
//列表刷新加载控件
implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
//列表适配器
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.30'
打开project.gradle,添加maven { url "https://jitpack.io" }
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
加载,无报错即添加依赖成功
2.在视图Activity的xml文件中添加控件,即给recyclerview外面套一层刷新控件smartRefreshLayout。
<



被折叠的 条评论
为什么被折叠?



