Android alpha animation: Staying in last animation frame when animation is completed
I'm fading out an imageview with alpha animation. I'd like the image to stay transparent after the animation. Tried with开发者_JS百科 different combinations of fillAfter and fillEnabled, no luck. How can this be achieved?
pom
setting fillEnabled and fillAfter to true always works for me.
anim = new AlphaAnimation(0.3f, 1.0f);
anim.setDuration(500);
anim.setFillEnabled(true);
anim.setFillAfter(true);
<view>.startAnimation(anim);
Add an Animation.AnimationListener
to the Animation
via setAnimationListener()
. In onAnimationEnd()
of the listener, call setVisibility(View.INVISIBLE)
on the ImageView
.
精彩评论