materialrefeshlayout下拉刷新,上拉加载更多

1.添加依赖:compile 'com.cjj.materialrefeshlayout:library:1.3.0'


2.布局中添加控件,包裹list控件
   <com.cjj.MaterialRefreshLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/refresh"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
   </com.cjj.MaterialRefreshLayout>

3.初始化布局控件

4.设置可上拉加更多:refresh.setLoadMore(true);

5.设置监听回调:refresh.setMaterialRefreshListener(new MaterialRefreshListener() {
  a:下拉刷新
   public void onRefresh(MaterialRefreshLayout materialRefreshLayout) {}
  b:上拉加载更多
   public void onRefreshLoadMore(MaterialRefreshLayout materialRefreshLayout) {}
posted @ 2017-04-24 20:10  内涵馒头  阅读(197)  评论(0编辑  收藏  举报