XRefreshLayout, 无侵入刷新你所有LayoutManager的RecyclerView

XRefreshLayout

Github Repository : https://github.com/li-xiaojun/XRefreshLayout
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 :

  • refresh RecyclerView for GridLayoutManager :

  • refresh RecyclerView for LinearLayoutManager :

  • refresh NestedScrollView :

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:1.0.0'
}

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 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 174,379评论 25 709
  • afinalAfinal是一个android的ioc,orm框架 https://github.com/yangf...
    passiontim阅读 15,629评论 2 45
  • 导语 简书是一个正在进行公测的写作与阅读平台,支持Markdown语法,实时预览;新建的文章可以直接发布成可访问的...
    LeoGump阅读 230评论 0 0
  • 镹壹阅读 299评论 0 1
  • 今天有幸听了重庆师范大学博导黄翔教授的课,黄翔教授还是国家课标组核心成员,所以对于核心素养的讲解非常全面而到位。 ...
    史改花阅读 366评论 0 3