AnimatorSet中before与after的理解

AnimatorSet bouncer = new AnimatorSet();
bouncer.play(bounceAnim).before(squashAnim1);
bouncer.play(squashAnim1).with(squashAnim2);
bouncer.play(squashAnim1).with(stretchAnim1);
bouncer.play(squashAnim1).with(stretchAnim2);
bouncer.play(bounceBackAnim).after(stretchAnim2);
ValueAnimator fadeAnim = ObjectAnimator.ofFloat(newBall, "alpha", 1f, 0f);
fadeAnim.setDuration(250);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.play(bouncer).before(fadeAnim);
animatorSet.start();



  1. Plays bounceAnim.
  2. Plays squashAnim1squashAnim2stretchAnim1, and stretchAnim2 at the same time.
  3. Plays bounceBackAnim.
  4. Plays fadeAnim.

      说明:播放bounceAnim  播放完成之后同时播放squashAnim1squashAnim2stretchAnim1和stretchAnim2 这四个播放完成之后播放bounceBackAnim  最后播放fadeAnim

原文地址:https://www.cnblogs.com/ZSS-Android/p/4479723.html