I have two simple buttons and one image:
clockwise button click event ==> rotates the image 1 degree in clockwise
anticlockwise button click event ==> rotates the image 1 degree in anticlockwise
how can I do that?
I have two simple buttons and one image:
clockwise button click event ==> rotates the image 1 degree in clockwise
anticlockwise button click event ==> rotates the image 1 degree in anticlockwise
how can I do that?
image.setRotation(angle)
works for API 11 and above.
-Edit Matrix works for lower API levels:
for clockwise:
Matrix matrix = new Matrix();
imageView.setScaleType(ScaleType.MATRIX);
matrix.postRotate(angle++, image.getDrawable().getBounds().width() / 2, image.getDrawable().getBounds().height() / 2);
image.setImageMatrix(matrix);
for anticlockwise, you can replace angle++ to angle--