CommonRefreshLayoutAndroid 下拉刷新、上拉加載
基于SwipeRefreshLayout下拉刷新、上拉加載。支持所有的AbsListView、RecycleView
特點(diǎn)
-
在 layout 中使用,支持 AbsListView 所有的xml屬性
-
支持自動(dòng)下拉刷新,什么用呢?比如進(jìn)入界面時(shí),只需要調(diào)用 autoRefresh() 方法即可,同時(shí)下拉刷新回調(diào)函數(shù)將會(huì)被調(diào)用。
-
上拉加載支持自定義 View 或設(shè)置加載文字、動(dòng)畫
-
輕松設(shè)置 Adapter 空數(shù)據(jù)視圖,默認(rèn)為 TextView 支持更文字,也可自定義 View
-
對(duì)于簡(jiǎn)單的界面,如只有 ListView 可以繼承 app 包中 Fragment 輕松搞定
使用
仔細(xì)看 listSelector 屬性,效果見(jiàn) sample
<com.mylhyl.prlayout.SwipeRefreshListView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/swipeRefresh" android:layout_width="match_parent" android:layout_height="match_parent" android:listSelector="@drawable/selector_list" tools:context=".app.ListViewXmlFragment" />
設(shè)置上拉加載,更多方法見(jiàn) IFooterLayout
IFooterLayout footerLayout = swipeRefreshListView.getFooterLayout();
footerLayout.setFooterText("set自定義加載");
footerLayout.setIndeterminateDrawable(getResources().getDrawable(R.drawable.footer_progressbar));
自定義adapter空數(shù)據(jù)視圖
ImageView emptyView = new ImageView(getContext()); emptyView.setImageResource(R.mipmap.empty); swipeRefreshGridView.setEmptyView(emptyView);
或
swipeRefreshListView.setEmptyText("數(shù)據(jù)呢?");
使用Gradle構(gòu)建時(shí)添加一下依賴即可:
compile 'com.mylhyl:pullrefreshlayout:1.0.0'
QQ交流群:435173211
評(píng)論
圖片
表情
