Andorid下拉刷新,上拉加载之SmartRefreshLayout

纠结于如何自定义下拉刷新和上拉加载能够自定义加载时候所显示的View
自己尝试了几天,都不怎理想
无意中在论坛发现SmartRefreshLayout
尝试了一下,感觉完美

详细的还是要看官方文档
奉上GitHub链接:https://github.com/scwang90/SmartRefreshLayout

自己写了个下拉刷新自定义头部View的Demo(与上拉加载的自定义View完全相同)

主要步骤如下:
1、build.gradle(Module:app)引入
2、布局文件中使用SmartRefreshLayout
3、自定义一个View,并实现RefreshHeader接口(具体方法实现请参考GitHub:https://github.com/scwang90/SmartRefreshLayout/blob/master/art/md_custom.md
4、在代码中让SmartRefreshLayout使用实现RefreshHeader接口的自定义View

主要代码:
1、build.gradle(Module:app)引入:
compile 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-alpha-1'
compile 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0-alpha-1'


build.gradle(Module:app)引入

2、布局文件中使用SmartRefreshLayout


布局文件中使用SmartRefreshLayout

3、自定义一个View,并实现RefreshHeader接口(具体方法实现请参考GitHub:https://github.com/scwang90/SmartRefreshLayout/blob/master/art/md_custom.md

自定义View代码部分

自定义View布局部分

4、在代码中让SmartRefreshLayout使用实现RefreshHeader接口的自定义View


SmartRefreshLayout使用实现RefreshHeader接口的自定义View.png

如果你看不懂我写的,没关系,去看github文档吧,里面写得特别详细。只要你耐心,反正我是懂了。。。。。。如果你需要,可以加我email我哦:994792649@qq.com

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容