美文网首页
Andorid下拉刷新,上拉加载之SmartRefreshLay

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

作者: 撸码小狂魔 | 来源:发表于2018-05-12 15:31 被阅读342次

纠结于如何自定义下拉刷新和上拉加载能够自定义加载时候所显示的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

相关文章

网友评论

      本文标题:Andorid下拉刷新,上拉加载之SmartRefreshLay

      本文链接:https://www.haomeiwen.com/subject/nnfqcftx.html