canvas.drawColor(Color.WHITE);
canvas.drawBitmap(dial, 0, 0, new Paint());
Matrix matrix = new Matrix();
matrix.setRotate(80);
matrix.preTranslate(-arrow.getWidth() / 2, -arrow.getHeight());
matrix.postTranslate(arrow.getWidth() / 2, arrow.getHeight());
Bitmap bb = Bitmap.createBitmap(arrow, 0, 0, arrow.getWidth(), arrow.getHeight(), matrix, true);
canvas.drawBitmap(bb, centerXY - bb.getWidth() / 2, 0, new Paint());
我搜索并阅读了许多关于“如何围绕android中心旋转图像”的帖子。但我的代码不起作用。我究竟做错了什么?您将通过屏幕截图看到结果: