I want to add multiple translate animations to one AnimationSet. I am currently doing this by setting a listener to the AnimationSet and performing a new AnimationSet on the method onAnimationEnd() (see below).This is alot of code and was wondering if this can be done in one AnimationSet
Any idea?
view_2_anim_c.setAnimationListener(new AnimationListener() {
public void onAnimationStart(Animation animation) {
// TODO Auto-generated method stub
}
public void onAnimationRepeat(Animation animation) {
// TODO Auto-generated method stub
}
public void onAnimationEnd(Animation animation) {
// TODO Auto-generated method stub
apa2.startAnimation(view_2_anim_d);
//viewBAnimationD(apa2, 0);
}
});
An AnimationSet can have any number of animations in it. If you would like the second translate animation to start after the first you can just set a startoffset on the second to be the same as the duration of the first. One limitation of this is that you can only perform the animations on a single view. If you wanted one view to translate and after that has finished a different view you should use the AnimationListener to run a new animation.