Android Picasso缓存图像 [英] Android picasso cache images

查看:89
本文介绍了Android Picasso缓存图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在书面文档中,毕加索会缓存下载的图像,但是我还没有看到如何从缓存中再次调用该图像的示例.

In documentation in written that picasso caches images downloaded , but i havent seen an example how to call that image again from cache.

这是我第一次加载图片:

Here i first time load the image :

Picasso.with(getActivity())
        .load(thirdArticle.getImageURL())
        .resize(200, 150)
        .centerCrop()
        .into(mainThreeArticleImage);

第二次,当我在上面调用相同的代码时,它不应该从缓存中获取??

Second time when i call same code above it shouldnt get from cache ???

如果没有,如何通过该URL调用缓存的图像?

If not, how to call cached images by that url ??

推荐答案

Picasso自动缓存加载的图像,以便下次从缓存中加载它们.您可以通过启用指示器来检查是否从Web,缓存或磁盘加载了图像

Picasso automatically caches the loaded images, So that next time they will be loaded from the cache. You can check whether the image is loaded from the web, cache or disk by enabling the indicator

setIndicatorsEnabled(true)

将为每个图像显示指示符,指定从何处加载图像.
我从此处

Indicators will be shown for each image, specifying where the image is loaded from.
I got the reference from here

这篇关于Android Picasso缓存图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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