在Android中,当我们从图库中打开屏幕截图时。它会模糊2秒,然后自动调整。图像不自动调整
但是,当我使用这个屏幕显示图像为使用图像路径上的ImageView的设置:,
图像路径是:/mnt/sdcard/ScreenCapture/SC20130219-124221.png
private void showImage(String imgPath) {
// TODO Auto-generated method stub
System.out.println("Image Path is: "+imgPath);
ImageView openImage=(ImageView)findViewById(R.id.img_fullScreen);
ExifInterface exifMedia = null;
try {
exifMedia = new ExifInterface(imgPath);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String exifOrint = exifMedia.getAttribute(ExifInterface.TAG_ORIENTATION);
int exifOrientation = Integer.parseInt(exifOrint);
System.out.println("Orientation Tag is:"+exifOrientation);
BitmapFactory.Options mOptions=new BitmapFactory.Options();
mOptions.inSampleSize=2;
Bitmap imgBitmap = BitmapFactory.decodeFile(imgPath,mOptions);
//Runtime.getRuntime().gc();
imgBitmap = getResizedBitmapImage(imgBitmap, 200, 200, exifOrientation);
openImage.setImageBitmap(imgBitmap);
}
另一种情况:从URL中获取位图:
URL url = new URL(urlTarget);
BitmapFactory.Options mOptions = new BitmapFactory.Options();
mOptions.inSampleSize=1;
Bitmap bmp = BitmapFactory.decodeStream(url
.openConnection().getInputStream(),null,mOptions);
然后图像不会自动调整自身。它来了BLURRED。这是我的问题。这是只在屏幕上的情况下。
感谢
你能粘贴getResizedBitmapImage()方法? – 2013-02-25 08:05:29
这是一个截图,所以使用'mOptions.inSampleSize = 1;'。否则,它肯定会变得模糊 – 2013-02-25 08:28:03
你好@SherifelKhatib它帮助我在上面的情况下,但从URL获取位图的情况下,它不起作用。你能否告诉我如何从URL中获取位图的情况下如何使用inSampleSize。我编辑了我的代码。请看看 – 2013-02-25 09:08:35