3
我必須嘗試刪除旋轉圖像後的黑色背景在我的代碼我如何能在Android的5.0
Bitmap rotate(float x, Bitmap bitmapOrg) {
int width = bitmapOrg.getWidth();
int height = bitmapOrg.getHeight();
int newWidth = 200;
int newHeight = 200;
float scaleWidth = ((float) newWidth)/width;
float scaleHeight = ((float) newHeight)/height;
Matrix matrix = new Matrix();
matrix.postScale(scaleWidth, scaleHeight);
matrix.postRotate(x);
Bitmap resizedBitmap = Bitmap.createBitmap(bitmapOrg, 0, 0, width,height, matrix, true);
//Canvas canvas = new Canvas(resizedBitmap);
//canvas.drawColor(Color.TRANSPARENT);
return resizedBitmap;
}
如何刪除黑色的背景我已經看到,只有刪除之後旋轉位圖圖像的黑色背景在我的android lolipop中,我也嘗試在我的模擬器Google galaxy nexus - 4.2.2中顯示黑色背景。
檢查我的答案:http://stackoverflow.com/a/38868813/3640366 – WoookLiu
仍然無法正常工作,它會得到黑色背景後面的圖像。感謝您的答覆。 –
你可以在這裏發佈你的代碼嗎? – WoookLiu