您的位置:首页 > 其它

PullToRefreshListView 进入界面不能立即显示刷新控件的bug 解决方案

2017-05-02 15:38 363 查看
1、首先定位到PullToRefreshListView.java这个文件

2、找到onRefreshing(final boolean doScroll)方法

@Override
protected void onRefreshing(final boolean doScroll) {
/**
* If we're not showing the Refreshing view, or the list is empty, the
* the header/footer views won't show so we use the normal method.
*/
/*ListAdapter adapter = mRefreshableView.getAdapter();
if (!mListViewExtrasEnabled || !getShowViewWhileRefreshing() || null == adapter || adapter.isEmpty()) {
super.onRefreshing(doScroll);
return;
}*/

super.onRefreshing(false);


按照上边的注释将代码注释掉,然后在需要显示刷新的地方调用mPullToRefreshListView.setRefreshing()就行了。

网友解释:

mPullRefreshListView.setRefreshing();如果adapter是里面的size是null 或者大小是0,这个时候 setRefreshing是不会有效果的.需要将PullToRefreshListView上面代码注释掉
一些属性的简单说明
ptrAnimationStyle : flip 这个效果是有向下和向上的两个箭头的,rotate 没有箭头不管怎么拉都是一个 progress bar
ptrModeboth 指的是 listview 的上面和下面都有这种拉动刷新的效果,下面的刷新通常我们在滑到最下面然后 loading 数据的时候可以看到更多。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: