问题很简单:我想围绕某个轴心点旋转图像。这里是我使用的代码:围绕枢轴点旋转图像
Matrix matrix = new Matrix();
matrix.setTranslate(bmpWidth/2, 0);
matrix.preRotate(degrees, bmpWidth/2, 0);
Bitmap resizedBitmap = Bitmap.createBitmap(
bitmap, 0, 0, bmpWidth, bmpHeight, matrix, true);
ImageView imageView = (ImageView) findViewById(R.id.bell);
imageView.setImageBitmap(resizedBitmap);
我从加速度传感器得到旋转角度。其结果是每次图像围绕其中心点旋转。
,但你可能例如,使用'postRotate()'或'setRotate()'来获得改变变换顺序的不同结果。 –
你能给我一个有效的例子吗?因为我试图使用这些方法,但我没有运气。谢谢! – Gratzi
我从来没有使用矩阵变换,所以我不能给你一个例子,但我想我已经阅读了有关如果没有以正确的顺序应用变换给出意想不到的结果的问题。如果您尝试在不使用'setTranslate()'的情况下使用* just *'postRotate()',它会起作用吗? –