{
ifheightratio1&&9idthratio1
以下代码片段指示caທmera应用程序应该将图像保存到设备的sd卡上,文件名为ฦmyfavoritepicturepg。
imvsetimageBitmaທpbmp;
publilass9dsActivity{
importandroidgraທphicsBitmap;
intdh=9tdisplaທygetheight;
加载图像的尺寸而不是图像本身
Bitmapfa9sbmpfa9e9apfactory
options;
bmpfa9ustde9ds=true;
Bitmapbmp=Bitmapfactorydecodefileimaທgefilepath,
bmpfa9s;๙
intheightratio=intmath9s6米6花6๔在6线6๔书6库6bkmihua
outheightfloatdh;
int9๗idthratio=intmath9s
out9idthfloat9;
logv"heightrAtio",ไ""+heightratio;๙
logv"9idthrAtio",""ิ+9idthratio;๙
如果两个比率都大于1,
那ว么图像的一条边将大于屏幕
ifheightraທtio1&&ุ9idthratio1