Eldo Varghese
Eldo Varghese

Reputation: 77

Rotation of an Image on touch

I am developing a simple application. I have an image(for e.g a wheel) on image view. I want to turn the image according to my finger moves(like rotating the wheel by hand) and stops it when i release the touch. I just rotate the image with simple animation without touching the screen. Kindly provide me a solution.

Upvotes: 0

Views: 1039

Answers (1)

vKashyap
vKashyap

Reputation: 580

Take a look at this.

You will have to create a custom view and handle the onTouch events to calculate rotation angle.

In onDraw method

  1. Save the canvas state.
  2. Rotate the canvas using Camera class.
  3. Draw the image on the canvas.
  4. Restore the canvas

Upvotes: 2

Related Questions