Is there a simple way to repeat a Android AnimatorSet
(infinite)? Can I set a AnimationListener
and restart the AnimatorSet
by calling
There is an answer for the first two questions
Is there a simple way to repeat a Android AnimatorSet (infinite)? Can I set a AnimationListener and restart the animatorSet by calling start() again?
Yes, there is:
mAnimationSet.addListener(new AnimatorListenerAdapter() {
private boolean mCanceled;
@Override
public void onAnimationStart(Animator animation) {
mCanceled = false;
}
@Override
public void onAnimationCancel(Animator animation) {
mCanceled = true;
}
@Override
public void onAnimationEnd(Animator animation) {
if (!mCanceled) {
animation.start();
}
}
});
mAnimationSet.start();
The answer for the third question, is no. The first animation will be repeated and after all repetitions the succeeding animation will be started.