1.属性:https://github.com/chrisbanes/Android-PullToRefresh/blob/master/library/res/values/attrs.xml
命名空间: xmlns:ptr="http://schemas.android.com/apk/res-auto"
ptr:ptrAnimationStyle | 动画效果 提供了两个值 flip和rotate 默认为rotate |
ptr:ptrRefreshableViewBackground | 设置刷新View的背景颜色 |
ptr:ptrHeaderBackground | 设置头部View的背景颜色 |
ptr:ptrHeaderTextColor | 设置头部View文字的颜色 |
ptr:ptrHeaderSubTextColor | 设置头部view副标题文字的颜色 |
ptr:ptrMode | pullFromStart: pullFromEnd: both; |
2.常用方法
setOnRefreshListener(OnRefreshListener listener):设置刷新监听器;
setOnLastItemVisibleListener(OnLastItemVisibleListener listener):设置是否到底部监听器;
setOnPullEventListener(OnPullEventListener listener);设置事件监听器;
onRefreshComplete():设置刷新完成
3.监听刷新listview,修改头部和底部view的文字说明:
mPullRefreshListView.getLoadingLayoutProxy().setRefreshingLabel(
"正在加载"
);
mPullRefreshListView.getLoadingLayoutProxy().setPullLabel(
"上拉加载更多"
);
mPullRefreshListView.getLoadingLayoutProxy().setReleaseLabel(
"释放开始加载"
);
refreshView.getLoadingLayoutProxy().setLastUpdatedLabel(
"最后加载时间:"
+ str);
mPullRefreshListView.getLoadingLayoutProxy().setRefreshingLabel(
"正在刷新"
);
mPullRefreshListView.getLoadingLayoutProxy().setPullLabel(
"下拉刷新"
);
mPullRefreshListView.getLoadingLayoutProxy().setReleaseLabel(
"释放开始刷新"
);
refreshView.getLoadingLayoutProxy().setLastUpdatedLabel(
"最后更新时间:"
+ str);