ImageView centerInside时setImageBitmap图片过小的解决方式

来源:互联网 发布:深入理解linux内核pdf 编辑:程序博客网 时间:2024/05/01 10:06
        BitmapFactory.Options opts = new BitmapFactory.Options();//        opts.inSampleSize = 4;        Bitmap bitmap = BitmapFactory.decodeFile(path, opts);        int originalWidth = bitmap.getWidth();        int originalHeight = bitmap.getHeight();        int winWidth = getWindowManager().getDefaultDisplay().getWidth();        int height = (winWidth*originalHeight)/originalWidth;        bitmap2 = Bitmap.createScaledBitmap(bitmap,winWidth ,height, true);        frameLayoutCropImage.addView(cropImageView = new CropImageView(this, bitmap2), new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));        if(bitmap.isRecycled() == false) {            bitmap.recycle();            bitmap = null;        }

这种情况要bitmap等比例到屏幕大小

0 0