Aspsine / IRecyclerView

IRecyclerView is a custom RecyclerView that supports pull-to-refresh, pull-to-loadmore, customize refresh header and loadmore footer, add header views and footer views.
730 stars 146 forks source link

7.0以下系统下拉刷新遇到的问题 #48

Closed ruijun closed 6 years ago

ruijun commented 6 years ago

@Aspsine 你好

4.4 6.0系统上:

  1. ActivityonCreate()中调用mListView.setRefreshing(true)来主动加载数据
  2. onRefresh()回调里进行数据加载,模拟加载几十条数据,然后再调用mListView.setRefreshing(false)
    List<User> list = new ArrayList<>();
    for (int i = 0; i < 30; i++) {
       User user = new User();
        list.add(user);
    }
    mAdapter.updateData(list);
    mListView.setRefreshing(false);

    按照上面的做法,数据能加载成功,但是再手动进行下拉刷新,就没有下拉的动画效果了。

问下,这种情况只能这样子处理吗?

mListView.post(new Runnable() {
 @Override
 public void run() {
      mListView.setRefreshing(false);
    }
 });