-
Support Pull Down To Refresh And Pull Up to Refresh.
-
支持下拉+上拉刷新。
Gradle:
compile 'com.biao:pulltorefresh:1.0.0-beta3'
- add more default refresh view
- go on optimize
##How to use!
<com.biao.pulltorefresh.PtrLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
..RecyclerView
..ListView
..BTW, now only support one child!
</com.biao.pulltorefresh.PtrLayout>
* DefaultRefreshView
* MaterialRefreshView
public void setHeaderView(View view);
public void setFooterView(View view);
BTW, if you custom the refresh view, as a general rule, you need to impl the PtrHandler..
// which impl PtrHandler is not refresh view, you need to set that:
public void setHeaderPtrHandler(PtrHandler ptrHandler);
public void setFootererPtrHandler(PtrHandler ptrHandler);
public interface PtrHandler {
/** when refresh begin */
void onRefreshBegin();
/** when refresh end */
void onRefreshEnd();
/** when refresh pulling */
void onPercent(float percent);
}
public void setOnPullDownRefreshListener(OnRefreshListener onRefreshListener);
public void setOnPullUpRefreshListener(OnRefreshListener onRefreshListener);
ptrLayout.setOnPullDownRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh() {
headerView.postDelayed(new Runnable() {
@Override
public void run() {
ptrLayout.onRefreshComplete();
}
}, 3000);
}
});
public void setMode(int mode);
PtrLayout.MODE_ALL_MOVE
PtrLayout.MODE_ONLY_CONTENT_NOT_MOVE
PtrLayout.MODE_ONLY_FOOTER_NOT_MOVE
PtrLayout.MODE_ONLY_HEADER_NOT_MOVE
PtrLayout.MODE_ONLY_CONTENT_MOVE
public void setHeaderReleaseDist(int dist);
public void setFooterReleaseDist(int dist);
public void setDuration(int duration)