I have several TextView I want to animate. I want to use the same animation but that start at different times for each TextView. I searched but could not find how. I tried setStartOffset, but it seems that I'm not using as directed. Someone could help me? This is my code:
TranslateAnimation animation = new TranslateAnimation(
Animation.ABSOLUTE, 0.0f, Animation.ABSOLUTE, 0.0f,
Animation.ABSOLUTE, -1500.0f, Animation.ABSOLUTE, 0.0f);
animation.setDuration(3000);
tvNumero1.startAnimation(animation);
//this fails:
animation.setStartOffset(300);
tvNumero2.startAnimation(animation);
I created different animations for the element, alternatively, you could use an animaiton from an xml resource. Here's the code:
Alternatively, you can define the animation in an XML file:
Here is the code for XML:
Previous code it seems it's waiting for the offset and then starts the whole animation, I changed it to 3 seconds, and it takes those 3 seconds to start.