链animatorSet动画的android [英] Chain animatorSet android animation

查看:181
本文介绍了链animatorSet动画的android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

新到Android我想作出一些平滑的动画。

New to android i would like to make some smooth animation.

我有一个包含对设备中的文件和每个效果的动画。文件告诉我当效果将播放和效果的持续时间。

I have a file on device that contains effects and each effect is an animation. The file tells me when an effect will be played and the effect duration.

问题是我无法链animatorSet dynmacily:

The problem is i cannot chain animatorSet dynmacily :

AnimatorSet mainAnimatorSet(); 
_listAllAnimator // Will contain every AnimatorSet(); 
for (int i = 0; i < listEffects; i++)
{
// Build animatorSet 
   ObjectAnimaTor1... 
   ObjectAnimaTor2... 
   AnimatorSet animatorSet = new AnimatorSet(); 
   animatorSet.play(ObjectAnimaTor1).with(ObjectAnimaTor2); 
   _listAllAnimator.add(animatorSet);

}

现在如何,我想mainAnimatorSet()从我AnimatorSet()的名单;每个动画在最后一个的端部开始。

Now how can i want mainAnimatorSet() from my list of AnimatorSet(); each animations start at the end of the last one.

for (int i = 0; i < _listAllAnimator.size(); i++)
{
if (i==0) {
  mainAnimatorSet.play(animSet.get(i));
}
else {
    mainAnimatorSet.play(animSet.get(i)).after(animSet.get(i-1)); 
}
}
mainAnimatorSet.start(); 

这是行不通的。
谢谢

This does not work. Thanks

推荐答案

我真的不得到你,但我张贴的答案呢。

i dont really get you but i am posting an answer anyway..

1
假设你你有一个ArrayList或列表的动画和你想在为了发挥这些动画启动离职后previous年底

AnimatorSet s = new AnimatorSet();
s.playSequentially(List<Animator> items); // items is your arraylist of animations

2
假设你你有一个ArrayList或列表的动画,并且希望在同一时间播放这些动画

AnimatorSet s = new AnimatorSet();
s.playTogether(List<Animator> items); // items is your arraylist of animations

这篇关于链animatorSet动画的android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆