Search code examples
javaandroidsequentialtranslate-animation

Android how to animate objects sequentially


I want to animate some multiple objects sequentially. As in, one animation should happen right after the previous animation stops.

I was using TranslateAnimations but it appears that all animations happen at the same time. I then tried putting all TranslateAnimations into an AnimationSet but this doesn't do what I imagined it would do.

What is the proper way to have multiple translateAnimations happen one after the other. Since this will loop, I can't just mess around with the setDuration because they will eventually get out of sync


Solution

  • You can use an AnimationListener to start the next animation after the previous one ends. This would make sure that only one runs at a time, and they go in the right order.