0

I have an round image in my app, and i want to let user rotate it by touching and sliding it up/down, and also i need to get the angle of this rotation( so if you touch the left bottom corner of the image, and later move your finger up to the top right corner, it will rotate by propper angle, and this angle should be accesable for real-time proccesing). What are the classes i should use or learn about?

Tytanit
  • 27
  • 1
  • 7
  • Please refer to this [question](https://stackoverflow.com/questions/11287737/rotating-an-image-and-displaying-angle-of-rotation). – luiswill Dec 02 '17 at 19:54

1 Answers1

0

Extend ImageView (actually, you could use any of a number of classes, but ImageView is a good start) and override onDraw(). Capture touch events with an OnTouchListener. There are loads of tutorials on the web, you could start here. This class manipulates the bitmap using the Matrix class and only implements pan and zoom but rotation is easy with a matrix also. To answer the question of how would you know the angle, you know because you set it!

In summary, learn how to extend ImageView, implement an OnTouchListener and utilize the Matrix class.

Simon
  • 14,407
  • 8
  • 46
  • 61