如何使毕加索更快地加载图像? [英] How to make Picasso load images faster?

查看:68
本文介绍了如何使毕加索更快地加载图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Picasso(Android的图像下载库). 毕加索网站

I use Picasso (image downloading library for Android). Picasso website

我像这样对我的图片收费:

I charge my image like this:

Picasso.get().load("http://i.imgur.com/myImage.png").into(imageView);

但是,如果myImage.png太大,则下载速度会变慢. (当然,互联网连接不良)

But, if myImage.png is too big, the download become slow. (With bad internet connection of course)

如何使Picasso更快地加载图像?

我可以通过毕加索降低画质吗?还是可以在使用前几秒钟向他们提早"收费?

请注意,我无法触摸文件myImage.png

Note that I cannot touch the file myImage.png

---------------------

编辑

有人知道如何提前"收取图片费用吗?我应该使用不可见视图并将图像加载到其中,然后在视图中使用相同图像吗?如何将图片添加到现金中(总是通过毕加索)?

Any idea how to charge an image "early"? Should I use invisible view and load image into it, then use the same image in my View? How to add an image to cash (By Picasso always)?

推荐答案

否,毕加索将该图像的较小版本加载到视图中以使用较少的内存,但是必须事先下载完整的源图像.

No, Picasso loads a smaller version of that image into the view to use less memory, However it has to download the full source image before hand.

考虑上传较小的图像以缩短下载时间,您可以使用图像的多个版本:

Consider uploading smaller images to have shorter download time, You may use multiple versions of your image:

image_thumbnail.png
image_small.png
image_medium.png
image_orginal.png

首先下载缩略图,然后下载小图像,使用大图像获得更大的视图.

Download the thumbnail first and then download the small image, Use the bigger images for bigger views.

是的,可以尽早"下载它们,但不建议您浪费宝贵的电池和带宽在手机上.

Yes it is possible to download them "early" but it's not recommend to waste the precious battery and bandwidth on mobile phones.

这篇关于如何使毕加索更快地加载图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆