0
當我旋轉一個位圖時,它會旋轉,但它會一直在屏幕上移動並同時旋轉。我想讓它在中心旋轉?我的代碼如下。位圖定位
try {
c = holder.lockCanvas();
// clear the canvas
c.drawColor(Color.BLACK);
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG|Paint.FILTER_BITMAP_FLAG);
if (c != null) {
int width=c.getWidth();
int height=c.getHeight();
c.drawBitmap(backgroundImage, 0, 0, null);
Matrix transform = new Matrix();
Matrix transform1=new Matrix();
transform.setRotate(degree, width/2,height/2);
c.drawBitmap(image1, transform, null);
//canvas.rotate(-90);
degree+=5;
c.restore();
}
}