如何从图像路径显示缩略图?

Mar*_*eiz 0 android thumbnails show imageview

如何在ImageView中显示固定图像路径的缩略图?

ρяσ*_*я K 8

您可以从图像路径创建图像缩略图:

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;
}
Run Code Online (Sandbox Code Playgroud)

在文件路径上调用此方法单击以在ImageView中显示图像缩略图