1
我使用此代码在图像视图(风景模式)中显示来自Sdcard的图像。但图像质量下降,模糊。从ImageView中的Sdcard中显示时,图像变得模糊Android
File imgFile = new File(imageFile.getAbsolutePath()); // path of your file
FileInputStream fis = null;
try {
fis = new FileInputStream(imgFile);
} catch (FileNotFoundException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 8;
options.inPurgeable = true;
options.inScaled = true;
Bitmap bm = BitmapFactory.decodeStream(fis, null,options);
profileIV.setImageBitmap(bm);
ImageView的XML文件:
<ImageView
android:id="@+id/image11"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
>
如果您知道毕加索比您不需要创建位图简单地使用您的图像(mContext).load(Uri.fromFile(new File(imagePath)))。)转换为(imgView);然后使用Picasso来显示你的图像。 –
让我试试这个 –
@mohit希望毕加索不会为更大的图像创建Heapsize问题 –