XRefreshLayout

简介:A refresh layout, can refresh RecyclerView for all LayoutManager, NestedScrollView and Any View that implements NestedScrollChild!
更多:作者   提 Bug   
标签:
RecyclerView 下拉刷新-

A refresh layout, can refresh RecyclerView for all LayoutManager, NestedScrollView and Any View that implements NestedScrollChild !

Feature

  • 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 !

Screenshot

  • refresh RecyclerView for StaggeredGridLayoutManager :

    staggered

  • refresh RecyclerView for GridLayoutManager :

    grid

  • refresh RecyclerView for LinearLayoutManager :

    linear

  • refresh NestedScrollView :

    nestedscroll

Depedency

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 {
    compile 'com.github.li-xiaojun:XRefreshLayout:lastest release here'
}

Get Start

  • 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(...);
    

Android 开发经验分享
Android 开发经验分享