I want to rotate the image (the bitmap inside the ImageView) around its center. This works pretty well, using the preRotate method with width / 2 and height / 2 Bitmap and 1 or -1 degrees as the rotation coefficient.
But I implemented rotation functions like buttons. Each time the "Rotate Right" button is pressed, the image is viewed one degree to the right and so on. It would be nice to press the button, and when the button is pressed, the image will begin to rotate until the button is released.
I read some topics here in which this function is implemented as OnTouchListener and not OnClickListener, but this does not work for me. If I implement loops in the MotionEvent.ACTION_DOWN event, then they are infinite. If I do not use loops, the event is processed only once (for example, in OnClickListener).
So, how can I increase / decrease the speed of rotation when a button is pressed?
android graphics
Vion
source share