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 
ptrMode :both 指的是 listview 的上面和下面都有这种拉动刷新的效果,下面的刷新通常我们在滑到最下面然后 loading 数据的时候可以看到更多。

相关文章:

  • 2022-02-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-22
  • 2022-12-23
  • 2021-05-10
猜你喜欢
  • 2022-12-23
  • 2021-09-05
  • 2021-08-20
  • 2021-11-06
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案