Reputation: 431
I'm adding an ImageView dynamically to my layout and then I want it to fade in. Unfortunately the image is added and then the animation is applied, so it has a flicker to it BEFORE the animation starts. I've tried to initially set the alpha to 0 then AlphaAnimate that in, but it never shows up. I tried using Invisible or Gone on the view visibility.
I'm using an AnimationSet to fade in with other animations, then wrapping that in another AnimationSet. Could this be the issue?
Code for animation is pretty simple. no tricks. but the view looks like it's added then taken away using this.
AlphaAnimation fadeIn = new AlphaAnimation(0,1);
fadeIn.setDuration(duration/3);
fadeIn.setFillAfter(true);
Upvotes: 7
Views: 9467
Reputation: 431
Removing it from a nested AnimationSet solved the issue. I was doing an alpha/tranlate/scale in an AnimationSet, then doing 2 of those in another AnimationSet to do a zoom in/zoom out scenario
Upvotes: 3
Reputation: 36866
Are you using AlphaAnimation.setFillAfter(true)?
http://developer.android.com/reference/android/view/animation/Animation.html#setFillAfter(boolean)
Upvotes: 0