I am trying to animate my Cart Icon on the Action Bar when clicking on Add Item. As the animation, I want to zoom-in the Cart icon a little, and then zoom-out back to the original size. How can I do it?
Asked
Active
Viewed 2,417 times
2
-
Can you use `Toolbar` instead? If yes, you can set a custom view that contains an `ImageView` and apply scale animation this way: http://stackoverflow.com/questions/11422421/android-image-view-scale-animation – Gennadii Saprykin Aug 08 '15 at 08:11
-
I have added the Cart as a menu item on Action Bar. Do not know how to move it to a custom view. :( – jetty Aug 08 '15 at 08:22
2 Answers
5
you can try this :
ScaleAnimation scale = new ScaleAnimation(0, 1, 0, 1, ScaleAnimation.RELATIVE_TO_SELF, .5f, ScaleAnimation.RELATIVE_TO_SELF, .5f);
scale.setDuration(500);
scale.setInterpolator(new OvershootInterpolator());
yourCartIcon.startAnimation(scale);

Rustam
- 6,485
- 1
- 25
- 25