@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); } }
mPullRefreshListView.setRefreshing();如果adapter是里面的size是null 或者大小是0
这个时候 setRefreshing是不会有效果的.需要将PullToRefreshListView上面代码注释掉
还有如果在下拉到底部的时候如果需要切换下拉的模式
需要 pull_to_ref_listview.onRefreshComplete();
在setData之前,不然会一直加载状态
private void setData(String ids) { List<Goods> list = getGoods(ids); if (list != null && list.size() > 0) { search_layout.setVisibility(View.VISIBLE); if (page == 1) { adapter.updateRefrushData(list); } else { adapter.updateMoreData(list); } int size = list.size(); if (size < PAGE_SIZE) { pull_to_ref_listview.setMode(Mode.PULL_FROM_START); } else { pull_to_ref_listview.setMode(Mode.BOTH); } } else if (page == 1) { mLoadingHolder.showEmpty(); } else { pull_to_ref_listview.setMode(Mode.PULL_FROM_START); } }