本文介绍了从URL加载GIF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图从网址中获取此GIF 像这样:
I tried to get this GIF from a URL like this:
Glide.with(context)
.load("http://artfcity.com/wp-content/uploads/2017/07/tumblr_osmx1ogeOD1r2geqjo1_540.gif")
.into(new GlideDrawableImageViewTarget(imageViewBaby) {
@Override
public void onResourceReady(GlideDrawable drawable, GlideAnimation anim) {
super.onResourceReady(drawable, anim);
imageViewBaby.setImageDrawable(drawable);
imageViewBaby.invalidate();
imageViewBaby.requestLayout();
}
});
但是GIF不会移动或启动.就像一张图片!如何解决这个问题?
But the GIF will not move or start. It's just like an image! How to solve this issue?
推荐答案
尝试一下
添加依赖项
implementation 'com.github.bumptech.glide:glide:4.4.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'
Gif加载
Glide.with(this)
.load("http://artfcity.com/wp-
content/uploads/2017/07/tumblr_osmx1ogeOD1r2geqjo1_540.gif")
.apply(RequestOptions.diskCacheStrategyOf(DiskCacheStrategy.NONE))
.into(imageView);
请参见 https://github.com/bumptech/glide/issues/2471
这篇关于从URL加载GIF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!