安卓笔记-----RecyclerView的加载和刷新(优秀的第三方库SmartRefreshLayout)
昨夜西风凋碧树,独上高楼。望尽天涯路。 二更,之前一直在忙,本来说更新一下关于RecyclerView 的东西,但是给耽误了,下次一定要补上,今天所做的东西主要是我们在APP中经常用到的刷新功能和加载更多功能,在此之前需要了解SmartRefreshLayout,由于这个知识点很多,有时间再单独写一篇博客,这里默认你已经了解过并且知道怎么用了,了解SmartRefreshLayout请自行百度搜索。这篇文章主要记录一下实现刷新和加载的一个简单例子,代码很简单。先上效果图: 下面开始贴代码,首先是需要添加的依赖。 //recyclerview的依赖 implementation "androidx.recyclerview:recyclerview:1.1.0" // For control over item selection of both touch and mouse driven selection implementation "androidx.recyclerview:recyclerview-selection:1.1.0-rc01" //smartrefresh以及经典的头部和尾部 implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0' implementation 'com