源码地址:https://github.com/scwang90/SmartRefreshLayout
implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-alpha-28'
implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0-alpha-28'//没有使用特殊Header,可以不加这行
<com.scwang.smartrefresh.layout.SmartRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/smart_refresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".business.vehicle.ui.notice.NoticeFragment">
<com.....widget.recycler.SkCustom2ClassicsHeader
android:layout_width="match_parent"
android:layout_height="150dp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/layout_empty" />
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp" />
</RelativeLayout>
<com.scwang.smartrefresh.layout.footer.ClassicsFooter
android:layout_width="match_parent"
android:layout_height="80dp" />
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
//刷新和加载
smartRefreshLayout.setOnRefreshListener(refreshLayout -> refresh());
smartRefreshLayout.setOnLoadMoreListener(refreshLayout -> loadMore());
//支持刷新和加载
smartRefreshLayout.setEnableRefresh(state);
smartRefreshLayout.setEnableLoadMore(state);
//刷新完成和加载完成
smartRefreshLayout.finishRefresh();
smartRefreshLayout.finishLoadMore();
//自动刷新
smartRefreshLayout.autoRefresh();
其中设置Header和Footer的方式,我们使用的是布局设置,除此之外还有全局设置和代码设置。
refresh-layout-kernel 核心必须依赖
refresh-header-classics 经典刷新头
refresh-header-radar 雷达刷新头
refresh-header-falsify 虚拟刷新头
refresh-header-material 谷歌刷新头
refresh-header-two-level 二级刷新头
refresh-footer-ball 球脉冲加载
refresh-footer-classics 经典加载
博主效果样式地址:https://github.com/scwang90/SmartRefreshLayout
属性地址:https://github.com/scwang90/SmartRefreshLayout/blob/master/art/md_property.md
博客地址:Android智能下拉刷新框架-SmartRefreshLayout
本文地址:https://blog.csdn.net/weixin_35691921/article/details/106899954
如对本文有疑问, 点击进行留言回复!!
蒲公英 · JELLY技术周刊 Vol.14: Vue 3 新特性详解
keepalived+haproxy+mycat+mysql高可用搭建配制
vue中子组件的created、mounted生命周期钩子中获取不到props中的值问题
网友评论