本文介绍了有什么方法可以检测毕加索缓存中正在加载的图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
作为标题建议我想检查是否从缓存中加载图像.
as title suggest I want to check whether images are loading from cache or not.
我已经做了类似的事情,但是没有成功.
I've done something like this but couldn't succeeded.
Picasso.with(getApplicationContext())
.load(data.get(position).get("product_image"))
.into(viewHolder.imgViewIcon, new Callback() {
@Override
public void onSuccess() {
viewHolder.imgViewIcon.setVisibility(View.VISIBLE);
if (Picasso.LoadedFrom.NETWORK != null)
YoYo.with(Techniques.ZoomIn).duration(1200)
.playOn(viewHolder.imgViewIcon);
viewHolder.placeholder.setVisibility(View.GONE);
}
@Override
public void onError() {
}
});
请有人有连击选项,然后告诉我.谢谢.
Please anyone have batter option then tell me.Thanks.
推荐答案
使用毕加索的setIndicatorEnabled(true)
检测图像的加载位置.
Use Picasso's setIndicatorEnabled(true)
to detect where the image is loaded from.
Picasso picasso = Picasso.with(context);
picasso.setIndicatorsEnabled(true);
//...
picasso.load("http://example.com/image.jpg").into(myImageView);
彩带将出现在左上角.
- 红色:网络
- 黄色:磁盘
- 绿色:内存
来源: Picasso-调试指示器
这篇关于有什么方法可以检测毕加索缓存中正在加载的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!