dha*_*ram 5 android rotation touch
我试图在图像视图中旋转图像,与触摸相对应,以修复图像的枢轴点.我见过许多例子,但我不清楚所有这些.有人有想法..这可以做到这一点吗?
由于没有提供有关位图绘制位置的代码或详细信息,我假设它位于屏幕的中心。您可以像这样在中心点旋转画布
double rotationAngleRadians = Math.atan2(currentX - centerX, centerY - currentY);
rotationAngleDegrees = (int) Math.toDegrees(rotationAngleRadians );
canvas.rotate(rotationAngleDegrees , centerX, centerY);
Run Code Online (Sandbox Code Playgroud)