Canvas:试图绘制太大(144609280 字节)的位图,位于 android.view.DisplayListCanvas.throwIfCannotDraw
Canvas: trying to draw too large(144609280bytes) bitmap, at android.view.DisplayListCanvas.throwIfCannotDraw
我从 Web 服务获取图像,我按照以下步骤将其显示在 imageView 中。
Picasso.with(getApplicationContext()).load(imageURL).fit().centerCrop().into(ivNews);
2 天前 2048X1600
分辨率的图像上传到服务器,突然应用程序开始崩溃并出现此异常 Canvas: trying to draw too large(144609280bytes) bitmap
服务器上传的图片有可能高于上述分辨率,以后服务器也可以上传更高分辨率的图片。
我看了this篇文章,里面提到glide
在性能方面比picasso更快更好,
它还提到如果你使用,.fit().centerCrop()
那么性能会更好,但我已经在使用这些,并且收到这些错误消息
我想用毕加索解决这个问题
如果图片较大,您可以使用scaleDown()
缩放图片。您可以像下面这样使用它。
Picasso
.with(context)
.load(<image_url>)
.resize(2048, 1600)
.onlyScaleDown() // the image will only be resized if it's bigger than 2048x 1600 pixels.
.into(<image_view>);
我从 Web 服务获取图像,我按照以下步骤将其显示在 imageView 中。
Picasso.with(getApplicationContext()).load(imageURL).fit().centerCrop().into(ivNews);
2 天前 2048X1600
分辨率的图像上传到服务器,突然应用程序开始崩溃并出现此异常 Canvas: trying to draw too large(144609280bytes) bitmap
服务器上传的图片有可能高于上述分辨率,以后服务器也可以上传更高分辨率的图片。
我看了this篇文章,里面提到glide
在性能方面比picasso更快更好,
它还提到如果你使用,.fit().centerCrop()
那么性能会更好,但我已经在使用这些,并且收到这些错误消息
我想用毕加索解决这个问题
如果图片较大,您可以使用scaleDown()
缩放图片。您可以像下面这样使用它。
Picasso
.with(context)
.load(<image_url>)
.resize(2048, 1600)
.onlyScaleDown() // the image will only be resized if it's bigger than 2048x 1600 pixels.
.into(<image_view>);