Picasso Taking time to load images

前提是你 提交于 2019-12-12 18:26:23

问题


I'm using picasso to load images in my recycler view adaper but it is taking to much time to load image. Here is my call to load image with picasso.

Picasso.with(hostActivity).load("ImageUrl").fit().centerCrop().into(holder.ImageView);

If I do same thing with asynctask task, image loaded instantly.

Am I doing any thing wrong?

Thanks.


回答1:


fit() needs to wait for the size of the ImageView to be determined before it can size the image to match, and the size can't be calculated until the end of the layout pass. You might get quicker results by using resize() if you are able to predict reasonable width and height values.

You might also want to look at the Glide library as it takes a different approach to caching that can be quicker than Picasso in some cases, for example instead of caching full size images it caches the resized ones. However, there are many pros and cons to both libraries; although the syntaxes are very similar, some things that work in Picasso will not work in Glide, and vice versa.



来源:https://stackoverflow.com/questions/35894427/picasso-taking-time-to-load-images

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!