Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android AnimatorSet animation + setStartDelay VS AnimatorListenener.onAnimationStart?

I have a question about the Android AnimatorSet object. I'm trying to create a TextView dynamically and set it's visibility to GONE and make it appear when my animation starts after the start delay. To accomplish this, I've setup an onAnimationStart listener to tell me when the animation is starting so that I can set the TextView to visible. I add that TextView into an AnimatorSet to perform some animations on the alpha and translateY but I also set the setStartDelay to a value so that the animation starts at 2500 milliseconds. My problem is that I want the TextView to become visible when the animation actually starts at the 2500 milli mark, but onAnimationStart is only being called when my AnimatorSet.start() function is being called, and not the requested 2500 milliseconds after. This is resulting in my TextView's becoming visible before their animation actually starts (after the setStartDelay period). How do I overcome this and get the TextView objects to go visible only after the setStartDelay period???? Thank you very very much, you are the best StackOverflow!!!! :) :) :)

like image 822
CryptoMonkey Avatar asked Mar 13 '13 04:03

CryptoMonkey


1 Answers

I have been having the same issue. I am animating 3 ValueAnimators in an AnimatorSet. I was doing a "playTogether()" in my set like so:

set.playTogether(alpha,animScale,transY);
set.start();

And found that the animation delay caused issues. Instead I tried the following:

set.play(animScale);
set.play(transY);
set.play(alpha);
set.start();

It seems to work!

like image 74
Daniel Avatar answered Oct 11 '22 13:10

Daniel