Dipak Keshariya
Dipak Keshariya

Reputation: 22291

How to Rotate or Scale ImageView with Image?

How to Rotate or Scale Image View with Image? Image View's Size is Wrap_Content and Rotate or Scale Image on Touch Event Of Image view.

Please Help Me.

Upvotes: 1

Views: 1529

Answers (1)

peter.bartos
peter.bartos

Reputation: 12045

You can use Animation on your ImageView. Here is an example for rotate animation:

    Animation anim = new RotateAnimation(0, ANGLE, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    anim.setDuration(DURATION);
    anim.setRepeatCount(0);
    anim.setFillAfter(true);
    image_view.startAnimation(anim);        

You can find similar solution for Scale and Translate animation. If you don't want to see animation, set duration to zero. The setFillAfter is important, if you dont want to reset the image after animation. Good luck

Upvotes: 2

Related Questions