Log.v("HEIGHTRATIO",""+heightRatio);
Log.v("WIDTHRATIO",""+widthRatio);
//如果两个比率都大于1,那么图像的一条边会大于屏幕
if (heightRatio > 1 && widthRatio > 1){
if (heightRatio > widthRatio){
//若高度比率更大,则根据它缩放
bmpFactoryOptions.inSampleSize = heightRatio;
}
else{
//若宽度比率更大,则根据它缩放
bmpFactoryOptions.inSampleSize = widthRatio;
}
}
// 对它进行真正的解码
bmpFactoryOptions.inJustDecodeBounds = false;
returnBmp = BitmapFactory.decodeStream(getContentResolver().
openInputStream(imageFileUri), null, bmpFactoryOptions);
} catch (FileNotFoundException e) {
Log.v("ERROR",e.toString());
}
return returnBmp;
}
}