在Glide中查找并​​加载缓存的图像 [英] Find and load cached Image in Glide

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

问题描述

我是滑行新手,希望将我的应用程序从UniversalImageloader迁移到滑行. 我想将磁盘上的缓存图像转换为图像文件,然后将其显示为ImageView.

I am new in glide and want to migrate my app from universalimageloader to glide. I want to convert cached image from the disk into image file, and show it into an ImageView.

当我使用Universalimageloader时,可以通过以下方式轻松实现:

When I use universalimageloader, I can do it easily with this way:

File imageFile = DiskCacheUtils.findInCache(image_url,  ImageLoader.getInstance().getDiscCache());
//then show it into image view
String file_target = "file://"+imageFile.getPath();
ImageLoader.getInstance().displayImage(target, imageView);

但是我还没有找到文档来在Glide中做到这一点.

However I have not found a way from documentation to do that in Glide.

有可能吗?

推荐答案

使用以下代码

Glide.with(mContext).load(ImageUrl).diskCacheStrategy(DiskCacheStrategy.SOURCE).into(imageView);

这篇关于在Glide中查找并​​加载缓存的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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