A refresh layout, can refresh RecyclerView for all LayoutManager, NestedScrollView and Any View that implements NestedScrollChild !
- support RecyclerView for all LayoutManager in vertical orientation !
- support NestedScrollView !
- support any view that implements NestedScrollChild !
- support custom refresh header and footer , which means you can make you wanderful animation !
- not support ListView, GridView, ScrollView !
-
refresh RecyclerView for StaggeredGridLayoutManager :
-
refresh RecyclerView for GridLayoutManager :
-
refresh RecyclerView for LinearLayoutManager :
-
refresh NestedScrollView :
-
custom refresh animation! There is two animation style now, I will support more animation in future...
Step 1. Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}Step 2. Add the dependency
dependencies {
implementation 'com.github.MyFisherTiger:JellyAndroidMaster:Tag'
}-
make your layout
<com.lxj.xrefreshlayout.XRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:id="@+id/xrefreshLayout" android:layout_height="match_parent"> <android.support.v7.widget.RecyclerView android:id="@+id/recyclerview" android:layout_width="match_parent" android:layout_height="match_parent"/> </com.lxj.xrefreshlayout.XRefreshLayout>
或者
<com.lxj.xrefreshlayout.XRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:id="@+id/xrefreshLayout" android:layout_height="match_parent"> <android.support.v4.widget.NestedScrollView android:id="@+id/recyclerview" android:layout_width="match_parent" android:layout_height="match_parent"/> </com.lxj.xrefreshlayout.XRefreshLayout>
-
you can choose
0.不修改,默认最简加载页面 1.你可以设置中文加载页面xrefreshLayout.setLoadingLayout(new ChineseLoadingLayout()); 2.或者自己继承ILoadingLayout接口实现自定义加载页面MLayout,然后xrefreshLayout.setLoadingLayout(new MLayout());即可
-
set refresh listener
xrefreshLayout.setOnRefreshListener(new XRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { } @Override public void onLoadMore() { } });
-
finish refresh
xrefreshLayout.completeRefresh();
-
set custom loadinglayout
//you can see the DefaultLoadingLayout for some help. xrefreshLayout.setLoadingLayout(...);




