更新时间:2023-02-02 21:49:15
使用侦听器,以便在提取图像并准备使用它时,可以使用您的saveImage
方法保存它.
Use the listener so that when the image is fetched and ready to be used, you can save it using the saveImage
method of yours.
执行此操作:
Glide.with(getContext()).load(apdInfo.url)
.thumbnail(0.5f)
.crossFade()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(new SimpleTarget<GlideDrawable>() {
@Override
public void onResourceReady(GlideDrawable glideDrawable, GlideAnimation<? super GlideDrawable> glideAnimation) {
apd_image.setImageDrawable(glideDrawable);
apd_image.setDrawingCacheEnabled(true);
saveImage();
}});
在onResourceReady()回调中调用saveImage
方法,并使用GlideDrawable
资源.我建议使用GlideDrawable
而不是使用Drawing Cache
获取图像.
Call the saveImage
method inside onResourceReady() callback and use the GlideDrawable
resource. I would suggest using the GlideDrawable
rather than getting the image using Drawing Cache
.