0
我創建了Imageview並使用Matrix進行旋轉。但背景不旋轉espouse圖像。旋轉背景資源Imageview
我是背景旋轉圖像。幫我
Bitmap myBitmap = BitmapFactory.decodeResource(getResources(),
R.drawable.a);
Display d = getWindowManager().getDefaultDisplay();
int x = d.getWidth();
int y = d.getHeight();
ImageView img1 = (ImageView) findViewById(R.id.img1);
Bitmap scaledBitmap = Bitmap.createScaledBitmap(myBitmap, y, x,
true);
Matrix matrix = new Matrix();
matrix.postRotate(-45); // anti-clockwise by 90 degrees
Bitmap rotatedBitmap = Bitmap
.createBitmap(scaledBitmap, 0, 0, scaledBitmap.getWidth(),
scaledBitmap.getHeight(), matrix, true);
img1.setImageBitmap(rotatedBitmap);
img1.setBackgroundResource(color.white);
要旋轉圖像? – kamil