RecyclerRefreshLayout
介绍:
为android提供下拉刷新,基于SwipeRefreshLayout,支持所有的View。
运行效果:
使用说明:
添加依赖:
dependencies {
compile 'com.dinuscxj:recyclerrefreshlayout:1.0.1'
}
Config in xml
<?xml version="1.0" encoding="utf-8"?>
<com.dinuscxj.refresh.RecyclerRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/refresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</app.dinus.com.refresh.RecyclerRefreshLayout>
在java中设置OnRefreshListener
mRecyclerRefreshLayout.setOnRefreshListener(OnRefreshListener);
自定义
你可以在RecyclerRefreshLayout添加一个 refresh view(需要实现IRefreshStatus)来实现你想要的UI。
public interface IRefreshStatus {
/**
* When the content view has reached top and refresh has been completed, view will be reset.
*/
void reset();
/**
* Refresh View is refreshing
*/
void refreshing();
/**
* Refresh View is dropped down to the refresh point
*/
void pullToRefresh();
/**
* Refresh View is released into the refresh point
*/
void releaseToRefresh();
/**
* @param pullDistance The drop-down distance of the refresh View
* @param pullProgress The drop-down progress of the refresh View and the pullProgress may be more than 1.0f
*/
void pullProgress(float pullDistance, float pullProgress);
}
设置 refresh view
mRecyclerRefreshLayout.setRefreshView(View, LayoutParams);
如果有必要,你可能需要参考 RefreshViewEg
已下载
0