I have an imageView that I want to start as invisible. After a certain button is clicked, I want to animate the Image into view and then I want it to remain at alpha 1. How do I do that? So far no luck. If I set the alpha to 0 in xml, then I never see the image. If I don't set alpha in xml then the image is always visible, and when the button is clicked it animates from 0 to 1 alpha.
Here is my animation code.
AlphaAnimation animation1 = new AlphaAnimation(0.0f, 1.0f);
animation1.setDuration(1000);
animation1.setStartOffset(5000);
animation1.setFillAfter(true);
tokenBtn.startAnimation(animation1);
Try to make your ImageView
invisible
in xml:Then, by adding an
AnimationListener
, make itvisible
inonAnimationStart
:In MainActivity.java add
Create file named blink.xml in res>anim folder and add this code
And make sure that onClick function on button is named blink
You can simply set initial alpha to 0 then animate it through 1 with desired duration;