ptListView.setMode(PullToRefreshBase.Mode.BOTH); ILoadingLayout refreshLayout = ptListView.getLoadingLayoutProxy(true,false); refreshLayout.setPullLabel("下拉刷新...");// 刚下拉时,显示的提示 refreshLayout.setRefreshingLabel("正在载入...");// 刷新时 refreshLayout.setReleaseLabel("放开刷新...");// 下来达到一定距离时,显示的提示 ILoadingLayout loadLayout = ptListView.getLoadingLayoutProxy(false,true); loadLayout.setPullLabel("上拉加载更多..."); loadLayout.setRefreshingLabel("正在载入..."); loadLayout.setReleaseLabel("放开加载...");
注意pulltorefreshlistview的标签默认颜色是白色,所以xml文件下记得修改颜色或者背景色
<com.handmark.pulltorefresh.library.PullToRefreshListView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/pt_listview" android:background="@color/white" android:listSelector = "#00000000" android:divider="@color/common_bg" android:dividerHeight="1px" ptr:ptrAnimationStyle="flip" ptr:ptrHeaderBackground="@color/common_bg"//修改标签背景色 ptr:ptrHeaderTextColor="@color/text_black"//修改标签颜色 ></com.handmark.pulltorefresh.library.PullToRefreshListView>