Matrix matrix = new Matrix();
matrix.setRotate(degree, bitmap.getWidth() / 2, bitmap.getHeight() / 2);
bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
Bitmap 用matrix 旋转出黑边_bitmap matrix.postrotate 有黑色-CSDN博客
Matrix matrix = new Matrix();
matrix.setRotate(degree, bitmap.getWidth() / 2, bitmap.getHeight() / 2);
bitmap.setHasAlpha(true); //解决空白处变黑
bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);