PullToRefreshListView插件初次进入页面自动刷新

时间:2022-01-30 04:41:33

只要将PullToRefreshListView源码中的:

@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;

// }

下面注释的部分注释掉再在想刷新的地方加上:

mPullToRefreshListView.setRefreshing(true);

就行了