使用Thumbnailutils显示缩略图时出现问题

时间:2014-10-06 23:00:09

标签: android android-imageview thumbnails

我使用此代码从完整尺寸的图片路径中获取缩略图:

imagenThumbnail = ThumbnailUtils.extractThumbnail(BitmapFactory.decodeFile(pathImagen), 320, 320);

问题在于,当我使用imageview显示缩略图时,显示缩略图向右旋转90度。图像是在垂直模式下拍摄的,但我不知道旋转显示的原因。

欢迎任何建议。

先谢谢你。

1 个答案:

答案 0 :(得分:2)

            ImageView iv;
            iv = (ImageView)findViewById(R.id.imageView);
            int THUMBSIZE = 64;

            // rotate bmpThumbImage
            Bitmap bmpThumbImage = ThumbnailUtils.extractThumbnail(BitmapFactory.decodeFile(fileUri.getPath()), THUMBSIZE, THUMBSIZE);
            iv.setScaleType(ImageView.ScaleType.CENTER_CROP);
            Matrix matrix = new Matrix();
            matrix.postRotate(90);
            bmpThumbImage = Bitmap.createBitmap(bmpThumbImage, 0, 0, bmpThumbImage.getWidth(),
                    bmpThumbImage.getHeight(), matrix, true);
            iv.setImageBitmap(bmpThumbImage);

How display thumbnail of video the same view of camera?