SwipeRefreshLayout的片段创作没有动画 [英] SwipeRefreshLayout no animation on fragment creation
问题描述
我用 android.support.v4.widget.SwipeRefreshLayout
与 android.support.v7.widget.RecyclerView
。照片
在片段视图创建我需要证明 SwipeRefreshLayout
动画。但是,当我打电话 setRefreshing(真)
没有任何反应。但是,当我刷新数据的动态变化。
我想,动画没有显示无子里面 SwipeRefreshLayout
。
如何显示这个动画的最佳方式?
I'm using android.support.v4.widget.SwipeRefreshLayout
with android.support.v7.widget.RecyclerView
.
On fragment view creation I need to show SwipeRefreshLayout
animation. But when I call setRefreshing(true)
nothing happens. But when I refresh data animation changes.
I suppose that the animation isn't showing without child inside SwipeRefreshLayout
.
How to show this animation in the best way?
推荐答案
谢谢你,伙计们。
I`ve只是意识到,最简单的解决方法是调用setRefreshing(真)之前调用方法测量(INT,INT)非零值)。问题发生,因为setRefreshing(真)的onMeasure之前调用。
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.
所以,你需要调用:
swipeRefreshLayout.measure(initialWidth, initialHeight);
swipeRefreshLayout.setRefreshing(true);
这篇关于SwipeRefreshLayout的片段创作没有动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!