我从一个Web服务获取图片,然后按照以下步骤在imageView中显示它。
Picasso.with(getApplicationContext()).load(imageURL).fit().centerCrop().into(ivNews);
2天前,在服务器上上传了一张2048X1600分辨率的图片,突然应用程序开始崩溃,并出现以下异常信息:Canvas: trying to draw too large(144609280bytes) bitmap
有可能上传到服务器上的图片高于所述分辨率,并且服务器也可以在未来上传更高分辨率的图片。
我阅读了这篇文章,提到了glide
在性能方面比picasso更快更好。
它也提到如果使用.fit().centerCrop()
,则性能更好,但我已经在使用这些方法并出现了错误信息。
我想通过使用picasso来解决这个问题。
Picasso.get().load(R.drawable.chat_image_placeholder).resize(1024, 800).onlyScaleDown().fit().centerCrop().into(thumbnailView)
- AndyBoy