Aditya Sawant
Aditya Sawant

Reputation: 323

Apply Scale Animation to a Button

I am trying to apply Animation to a button. What I want to do is when I press a button depending on the pressure I put, the button should scale down or up accordingly. If I release, it should come back to its original size. How do I do it?

Upvotes: 0

Views: 603

Answers (1)

Raza Ali Poonja
Raza Ali Poonja

Reputation: 1106

You can use this code for scale animation

ScaleAnimation animation = new ScaleAnimation(fromXscale, toXscale, fromYscale, toYscale, Animation.RELATIVE_TO_SELF, (float)0.5, Animation.RELATIVE_TO_SELF, (float)0.5);

For more Information: http://developer.android.com/reference/android/view/animation/ScaleAnimation.html

Upvotes: 2

Related Questions