本文介绍了如何显示从图像路径缩略图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我怎么能显示来自一个固定的图片路径的缩略图中的ImageView?
How can I show a thumbnail from a fixed image path in an ImageView?
推荐答案
您可以从图像路径创建图片缩略图:
you can create Image thumbnail from the image path as:
public Bitmap getbitpam(String path){
Bitmap imgthumBitmap=null;
try
{
final int THUMBNAIL_SIZE = 64;
FileInputStream fis = new FileInputStream(path);
imgthumBitmap = BitmapFactory.decodeStream(fis);
imgthumBitmap = Bitmap.createScaledBitmap(imgthumBitmap,
THUMBNAIL_SIZE, THUMBNAIL_SIZE, false);
ByteArrayOutputStream bytearroutstream = new ByteArrayOutputStream();
imgthumBitmap.compress(Bitmap.CompressFormat.JPEG, 100,bytearroutstream);
}
catch(Exception ex) {
}
return imgthumBitmap;
}
调用此方法对文件路径点击显示的ImageView图像缩略图
call this method on filepath click to show Image thumbnail in ImageView
这篇关于如何显示从图像路径缩略图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!