Android SwipeRefreshLayout停止刷新而不显示动画
我知道调用myRefreshLayout.SetRefresh(false)将结束刷新动画。。。但是,它不仅停止,它还完成当前的旋转并在屏幕外设置动画 在某些情况下,有没有办法避免这种情况?我希望它能立即消失 谢谢 试试这个:Android SwipeRefreshLayout停止刷新而不显示动画,android,swiperefreshlayout,Android,Swiperefreshlayout,我知道调用myRefreshLayout.SetRefresh(false)将结束刷新动画。。。但是,它不仅停止,它还完成当前的旋转并在屏幕外设置动画 在某些情况下,有没有办法避免这种情况?我希望它能立即消失 谢谢 试试这个: int cnt = swiperefresh.getChildCount(); for(int i=0; i<cnt; i++) { View
int cnt = swiperefresh.getChildCount();
for(int i=0; i<cnt; i++) {
View ch = swiperefresh.getChildAt(i);
if(ch.getClass().getSimpleName().equals("CircleImageView")) {
ch.clearAnimation();
ch.setVisibility(View.GONE);
swiperefresh.setRefreshing(false);
ch.clearAnimation();
break;
}
}
int cnt=swiperefresh.getChildCount();
对于(int i=0;i请尝试以下方法:
int cnt = swiperefresh.getChildCount();
for(int i=0; i<cnt; i++) {
View ch = swiperefresh.getChildAt(i);
if(ch.getClass().getSimpleName().equals("CircleImageView")) {
ch.clearAnimation();
ch.setVisibility(View.GONE);
swiperefresh.setRefreshing(false);
ch.clearAnimation();
break;
}
}
int cnt=swiperefresh.getChildCount();
对于(int i=0;i我找到了一种优雅的方法。在SwipeRefreshLayout
中有一个reset()
方法,该方法取消动画并立即隐藏无动画绘制的进度。不幸的是,该方法是包私有的。但在setEnabled(false)
期间调用它,因此您可以这样使用它:
swipeRefreshLayout.setEnabled(false)
swipeRefreshLayout.setEnabled(true)
我找到了一种优雅的方法。在SwipeRefreshLayout
中有一个reset()
方法,该方法取消动画并立即隐藏无动画可绘制的进度。不幸的是,该方法是包私有的。但它在setEnabled(false)
期间被调用,因此您可以这样使用它:
swipeRefreshLayout.setEnabled(false)
swipeRefreshLayout.setEnabled(true)