糾結(jié)于如何自定義下拉刷新和上拉加載能夠自定義加載時(shí)候所顯示的View
自己嘗試了幾天,都不怎理想
無意中在論壇發(fā)現(xiàn)SmartRefreshLayout
嘗試了一下,感覺完美
詳細(xì)的還是要看官方文檔
奉上GitHub鏈接:https://github.com/scwang90/SmartRefreshLayout
自己寫了個(gè)下拉刷新自定義頭部View的Demo(與上拉加載的自定義View完全相同)
主要步驟如下:
1、build.gradle(Module:app)引入
2、布局文件中使用SmartRefreshLayout
3、自定義一個(gè)View,并實(shí)現(xiàn)RefreshHeader接口(具體方法實(shí)現(xiàn)請參考GitHub:https://github.com/scwang90/SmartRefreshLayout/blob/master/art/md_custom.md)
4、在代碼中讓SmartRefreshLayout使用實(shí)現(xiàn)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'
2、布局文件中使用SmartRefreshLayout
3、自定義一個(gè)View,并實(shí)現(xiàn)RefreshHeader接口(具體方法實(shí)現(xiàn)請參考GitHub:https://github.com/scwang90/SmartRefreshLayout/blob/master/art/md_custom.md)
4、在代碼中讓SmartRefreshLayout使用實(shí)現(xiàn)RefreshHeader接口的自定義View
如果你看不懂我寫的,沒關(guān)系,去看github文檔吧,里面寫得特別詳細(xì)。只要你耐心,反正我是懂了。。。。。。如果你需要,可以加我email我哦:994792649@qq.com