我有两个简单的按钮和一张图片:
顺时针按钮点击事件==>顺时针旋转图像1度
逆时针按钮点击事件==>将图片逆时针旋转1度
我该怎么做?
最佳答案
image.setRotation(angle)
适用于 API 11 及更高版本。
-编辑 矩阵适用于较低的 API 级别:
顺时针:
Matrix matrix = new Matrix();
imageView.setScaleType(ScaleType.MATRIX);
matrix.postRotate(angle++, image.getDrawable().getBounds().width() / 2, image.getDrawable().getBounds().height() / 2);
image.setImageMatrix(matrix);
对于逆时针,可以将angle++替换为angle--
关于安卓 : rotate an image clockwise and anticlockwise with two simple buttons,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27909652/