2013-12-10 56 views

回答

0

可以使用下面的代碼示例縮放圖像以80%的大小。

int srcWidth = srcBitmap.getWidth(); 
int srcHeight = srcBitmap.getHeight(); 
int dstWidth = (int)(srcWidth*0.8f); 
int dstHeight = (int)(srcHeight*0.8f); 
Bitmap dstBitmap = Bitmap.createScaledBitmap(srcBitmap, dstWidth, dstHeight, true); 

根據您需要縮放的百分比更改多個值。

此外,請參閱此鏈接瞭解更多選項。 Scaling bitmap to 80 percent