1
 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 中围绕中心旋转图像”的帖子。但是我的代码不起作用。我究竟做错了什么?您将通过屏幕截图看到结果:

http://s58.radikal.ru/i161/1305/aa/b855c2ed8af6.jpg

4

0 回答 0