SwipeRefreshLayout no animation on fragment creation

前端 未结 5 2101
感情败类
感情败类 2021-01-05 03:58

I\'m using android.support.v4.widget.SwipeRefreshLayout with android.support.v7.widget.RecyclerView.
On fragment view creation I need to show <

5条回答
  •  伪装坚强ぢ
    2021-01-05 04:05

    Thanks, guys.

    I`ve just realised that the easiest solution is to call method measure(int, int) with non-zero values) before calling setRefreshing(true). The problem is happening because setRefreshing(true) is calling before onMeasure.

    So you need to call:

    swipeRefreshLayout.measure(initialWidth, initialHeight);
    swipeRefreshLayout.setRefreshing(true);
    

提交回复
热议问题