Android旋转/连续旋转图像,直到我命令它停止 [英] android spin / continuously rotate an image untill I command it to stop
本文介绍了Android旋转/连续旋转图像,直到我命令它停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想制作一个新图标。
I want to make a little fresh icon.
当我单击它时,我希望它像进度对话框一样旋转,直到刷新完成,然后它必须停止旋转。
When I click on it, I want it to spin like a progress dialog, until my refresh is completed, then it must stop spinning.
如何实现?
我尝试了如下动画:
RotateAnimation rotateAnimation = new RotateAnimation(30, 90,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
refreshBtn.startAnimation(rotateAnimation);
但这只会旋转一次或两次然后停止。
but that only rotates once or twice and then stops.
推荐答案
尝试一下:
RotateAnimation rotateAnimation = new RotateAnimation(30, 90,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
rotateAnimation.setRepeatCount(Animation.INFINITE);
rotateAnimation.setRepeatMode(Animation.RESTART);
refreshBtn.startAnimation(rotateAnimation);
这篇关于Android旋转/连续旋转图像,直到我命令它停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文