2010-11-17 151 views

回答

4

采用了矩阵:

int width = bitmap.getWidth(); 
int height = bitmap.getHeight(); 

float scaleWidth = ((float) newWidth)/width; 
float scaleHeight = ((float) newHeight)/height;  

matrix = new Matrix(); 

matrix.postScale(scaleWidth, scaleHeight); 

Bitmap resizedBitmap = Bitmap.createBitmap(bitmap, 0, 0, 
        width, height, matrix, true); 
1

或者Bitmap.createScaledBitmap(...)