I’d like to implement an alpha animation when clicking one of the buttons.
The animation is: Alpha down from 1 to 0.5 and when it reaches the 0.5 back again from 0.5 to 1.
Cycling both animations. How can I do it? Is posible to define it in a xml file in /res/anim folder or is necesary to use the AnimationListener?
Thanks
You can use a simple
AlphaAnimationobject to do this. Set the repeat mode tosetRepeatMode(Animation.REVERSE)for changing alpha from 0.5 back to 1.0 andsetRepeatCount(count)for number of times to repeat.sample animation xml:
code for loading the xml:
Code is just a sample. Hope this works.