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等比例到屏幕大小
ImageView centerInside时setImageBitmap图片过小的解决方式
最新推荐文章于 2021-05-26 05:51:22 发布