CommonRefreshLayout Android 下拉刷新、上拉加载开源项目

我要开发同款
匿名用户2016年06月14日
37阅读
开发技术Java
所属分类AndroidUI组件、手机/移动开发、Android UI 组件
授权协议GPL

作品详情

基于SwipeRefreshLayout下拉刷新、上拉加载。支持所有的AbsListView、RecycleView

特点

 在layout中使用,支持AbsListView所有的xml属性

 支持自动下拉刷新,什么用呢?比如进入界面时,只需要调用autoRefresh()方法即可,同时下拉刷新回调函数将会被调用。

 上拉加载支持自定义View或设置加载文字、动画

 轻松设置Adapter空数据视图,默认为TextView支持更文字,也可自定义View

 对于简单的界面,如只有ListView可以继承 app 包中Fragment轻松搞定

使用

仔细看listSelector属性,效果见sample

<com.mylhyl.prlayout.SwipeRefreshListView xmlns:android="https://schemas.android.com/apk/res/android"    xmlns:tools="https://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" />

设置上拉加载,更多方法见 IFooterLayout

        IFooterLayout footerLayout = swipeRefreshListView.getFooterLayout();        footerLayout.setFooterText("set自定义加载");        footerLayout.setIndeterminateDrawable(getResources().getDrawable(R.drawable.footer_progressbar));

自定义adapter空数据视图

        ImageView emptyView = new ImageView(getContext());        emptyView.setImageResource(R.mipmap.empty);        swipeRefreshGridView.setEmptyView(emptyView);

        swipeRefreshListView.setEmptyText("数据呢?");

使用Gradle构建时添加一下依赖即可:

compile 'com.mylhyl:pullrefreshlayout:1.0.0'

QQ交流群:435173211

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论