如何在Glide中将动画应用于缓存的图像 [英] How to apply animation on cached image in Glide

查看:164
本文介绍了如何在Glide中将动画应用于缓存的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Glide动画显示图像.我正在从服务器下载此图像.从服务器下载动画时,动画工作正常,但是从Glide缓存中获取图像时,动画不工作

I want to show the image using Glide animation. I'm downloading this image from the server. The animation is working fine when it downloads from the server but it's not working when the image is taken from Glide cache

requestOptions.skipMemoryCache(true);
requestOptions.diskCacheStrategy(DiskCacheStrategy.ALL);

请在下面检查我的代码

RequestOptions requestOptions = new RequestOptions();
requestOptions.timeout((int) NetworkParam.CONNECTION_TIME_OUT);
requestOptions.placeholder(R.drawable.img_blue_shirt);
requestOptions.priority(Priority.HIGH);
requestOptions.signature(new ObjectKey(String.valueOf(imgName)));
//requestOptions.skipMemoryCache(true);
requestOptions.diskCacheStrategy(DiskCacheStrategy.NONE);

//requestOptions.error(R.drawable.img_blue_shirt);
try {
    Glide.with(imageView.getContext().getApplicationContext())
         .load(imgUrl)
         .transition(GenericTransitionOptions.with(R.anim.anim_slide_in_left))
         .apply(requestOptions)
         .into(imageView);
} catch (Exception ex) {
    ex.printStackTrace();
}

推荐答案

是的,我在这里得到了答案,我们无法在缓存的图像中滑动应用动画以获取更多信息,请检查以下链接

yes I got my answer here we cant apply animation on cached image in glide for more info please check below link

https://bumptech.github.io/glide/doc/transitions.html

这篇关于如何在Glide中将动画应用于缓存的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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