<span style="font-size:14px;"> FileInputStream inputStream = null;
File file = new File(images.get(position));
try {
inputStream = new FileInputStream(file);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = (int) ((file.length()/1024)%50);
Bitmap bitmap = BitmapFactory.decodeStream(inputStream, null, options);
try {
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
imageView.setImageBitmap(bitmap);</span>
安卓中缩放图片到imageview(imageview出现OutOfMemoryError)
最新推荐文章于 2016-12-15 17:30:07 发布