Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Merge two animations in Android

I'm trying to combine two animations programmatically. In that simplified example:

 Animation translate = new TranslateAnimation(0, -100, 0, 0);
     translate.setDuration(1000);
 Animation zoom = new ScaleAnimation(0, 1, 0, 1);
     zoom.setDuration(1000);

I want the view make both animations at the same time. How can I do it?

The background of that question is because I have a more complex animation in a xml file and I want to combine that animation with a translation without modifying the original xml.

Thanks

like image 259
Addev Avatar asked Aug 15 '11 12:08

Addev


2 Answers

Merge two Animation using AnimationSet

like image 113
Alex Avatar answered Oct 31 '22 15:10

Alex


You can go for AnimationSet and add both animations into that AnimationSet and start that AnimationSet

like image 3
Android Killer Avatar answered Oct 31 '22 17:10

Android Killer