重复AnimatorSet [英] Repeat AnimatorSet
问题描述
有没有简单的方法可以重复Android AnimatorSet
(无限)?我可以设置 AnimationListener
并通过调用 start()$ c重新启动
AnimatorSet
吗?再次$ c>?
Is there a simple way to repeat a Android AnimatorSet
(infinite)? Can I set a AnimationListener
and restart the AnimatorSet
by calling start()
again?
我的 AnimatorSet
包含两个顺序播放的动画。
因此,如果我将两个动画的重复模式都设置为重复,那么第一个动画将在第二个动画运行时重复,对吗?
My AnimatorSet
contains two animations that are played sequentially.
So if I set the repeat mode of both single animation to repeat, than the first will be repeated while the second runs, right?
推荐答案
设置其子对象动画制作者的重复模式和计数;
set it's child object animators' repeat mode and count;
objectAnimator.setRepeatCount(ObjectAnimator.INFINITE);
objectAnimator.setRepeatMode(ObjectAnimator.RESTART/REVERSE...);
但是,由于另一个错误,将无法停止或取消该操作。
This won't be able to be stopped, or cancelled, however, due to yet another bug.
显然,我不喜欢在Android中为事物设置动画的各种方式,并且使它们都以一种或另一种方式使您失败。希望这对其他人有帮助。
clearly, I'm not a fan of the myriad ways in which you can animate things in Android, and have them all fail you in one way or the other. Hope this helps somebody else.
这篇关于重复AnimatorSet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!