(一)图片下载缓存好
之后获取
Glide.with(mContext).load(url).asBitmap().into(new SimpleTarget<Bitmap () {
@Override
public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap glideAnimation) {
image.setImageBitmap(resource);
}
});
(二)URL
Bitmap myBitmap = Glide.with(applicationContext)
.load(yourUrl)
.asBitmap()
.centerCrop()
.into(500, 500)
.get()
(三)获取图片缓存路径
FutureTarget<File future = Glide.with(mContext)
.load("url")
.downloadOnly(500, 500);
try {
File cacheFile = future.get();
String path = cacheFile.getAbsolutePath();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}