sunfusheng / GlideImageView

基于Glide V4.9.0封装的图片加载库,可以监听加载图片时的进度
https://github.com/sunfusheng/GlideImageView
1.77k stars 272 forks source link

RecyclerView 中加载glideImageView 过多 导致内存溢出,怎么解决一下? #40

Closed ps130183 closed 6 years ago

ps130183 commented 6 years ago

问题指向shapeImageView 中的 drawDrawable()方法 的 bitmap缩放的时候。 //Bitmap缩放 float scaleWidth = ((float) getWidth()) / bitmap.getWidth(); float scaleHeight = ((float) getHeight()) / bitmap.getHeight(); Matrix matrix = new Matrix(); matrix.postScale(scaleWidth, scaleHeight); bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true); canvas.drawBitmap(bitmap, 0, 0, paint); canvas.restore();

sunfusheng commented 6 years ago

ShapeImageView是有问题的也不是好的办法,在GlideImageView V2.0.0版本中去掉了,欢迎测试体验