【发布时间】:2014-04-10 11:46:42
【问题描述】:
三星 S4
三星 S3
我从网站下载图像并将它们保存到 SD 卡。当我使用 samsung s3 时,一切都是正常的图像被缩放并且宽度是 match_parent 但是当我使用 samsung s4 图像的宽度是 maxmımum 这个尺寸时,我从 sd 卡读取图像时检查图像的宽度和高度,这些是相同的,没有区别 samsung s3 和 s4。我用于从 sd 卡读取图像的代码
String root = Environment.getExternalStorageDirectory().toString();
File myDir = new File(root + "/sample");
myDir.mkdirs();
String fname = "Image_"+ ana.haberBanner.get(position).getId() +".jpg";
File file = new File (myDir, fname);
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
Bitmap bitmap = null;
try {
bitmap = BitmapFactory.decodeStream(new FileInputStream(file), null, options);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
haberResim.setImageBitmap(bitmap);
这段代码运行正常。
【问题讨论】:
标签: android bitmap bitmapfactory