实现嵌套滑动机制的通用下拉刷新和加载更多 – PowerRefresh

PowerReresh

实现嵌套滑动机制的通用下拉刷新和加载更多。

Add Header

CircleHeaderView header = new CircleHeaderView(getContext());
    mRefreshLayout.addHeader(header);

Add footer

FootView footView = new FootView(getContext());
mRefreshLayout.addFooter(header);

Callback

you should makeHeaderimplHeaderListener,so you can know the refresh state.and toFooterwithFooterListener.

mRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
    @Override
    public void onRefresh() {
		//doRefresh
    }

    @Override
    public void onLoadMore() {
      //doLoadmore
    }
});

Layout

<com.lovejjfg.powerrefresh.PowerRefreshLayout
android:id="@+id/refresh_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
    <android.support.v7.widget.RecyclerView
        android:id="@+id/recycler"
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context="com.lovejjfg.demo.MainActivity">
    </android.support.v7.widget.RecyclerView>

</com.lovejjfg.powerrefresh.PowerRefreshLayout>

本站文章除注明转载外,均为本站原创或编译
转载请明显位置注明出处:实现嵌套滑动机制的通用下拉刷新和加载更多 – PowerRefresh