你可以用
ObjectAnimator
和
AnimatorSet
把这些积木按顺序翻译到最下面,并稍加延迟。
你需要的代码是这样的:
ObjectAnimator translateAnimator1 = ObjectAnimator.ofFloat(view1, "translationY", 0, 500).setDuration(2500);
ObjectAnimator translateAnimator2 = ObjectAnimator.ofFloat(view2, "translationY", 0, 500).setDuration(2500);
translateAnimator2.setStartDelay(500);
ObjectAnimator translateAnimator3 = ObjectAnimator.ofFloat(view3, "translationY", 0, 500).setDuration(2500);
translateAnimator3.setStartDelay(1000);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.play(translateAnimator1).with(translateAnimator2).with(translateAnimator3);
animatorSet.start();
和
动画师集
有一些额外的属性,比如
setRepeatCount
等等,也许有用。