在 Android 中的 playTogether AnimatorSet 中对连续 AnimatorSet 进行动画处理

Ale*_*IIP 5 animation android android-animation

我正在尝试使用 AnimatorSets 链接一组动画。

我有这样的事情:

AnimatorSet sequentialSet = new AnimatorSet();
sequentialSet.playSequentially(animOne, animTwo, animThree);

AnimatorSet togetherSet = new AnimatorSet();
togetherSet.playTogether(sequentialSet, animFour, animFive);
togetherSet.setDuration(ANIM_TIMEOUT);
togetherSet.start();
Run Code Online (Sandbox Code Playgroud)

然而,发生的情况是,animOne 与 animFour 和 animFive 一起制作动画,然后动画 animTwo 和 animThree 发生。有没有人见过这个,有没有办法让动画 animOne、animTwo、animThree 与 animFour 和 animFive 同时执行?

谢谢您的帮助。

Ale*_*IIP 4

问题在于它togetherSet.setDuration(ANIM_TIMEOUT)覆盖了其中所有动画的持续时间。我的解决方案是为每个动画单独设置持续时间,而不是在集合本身上设置它。