如何在 Glide 上显示 gif
How to show gif on Glide
我想在回收器适配器中的 Glide error() 上显示 gif。
我该怎么做?
我想在Glide中显示图片,当网络断开时,我会显示一个Gif,但Glide Gif不会显示。
这是我的滑行代码,它只显示 loading_back.gif 而没有显示 connection_fail.gif .
RequestOptions options = new RequestOptions()
.centerCrop()
.placeholder(R.drawable.static_place_holder)
.error(R.drawable.connection_fail)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.priority(Priority.HIGH);
Glide.with(context)
.load(items.get(pos).getLinks())
.apply(options)
.thumbnail(Glide.with(context).load(R.drawable.loading_back))
.thumbnail(Glide.with(context).load(R.drawable.connection_fail))
.into(holder.imageView);
来自 This and 个问题。
build.gradle(应用级)
dependencies {
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
}
使用Glide.
Glide.with(context)
.load(imgUrl)
.asGif()
.placeholder(R.drawable.img)
.crossFade()
.into(imageView);
我想在回收器适配器中的 Glide error() 上显示 gif。 我该怎么做?
我想在Glide中显示图片,当网络断开时,我会显示一个Gif,但Glide Gif不会显示。 这是我的滑行代码,它只显示 loading_back.gif 而没有显示 connection_fail.gif .
RequestOptions options = new RequestOptions()
.centerCrop()
.placeholder(R.drawable.static_place_holder)
.error(R.drawable.connection_fail)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.priority(Priority.HIGH);
Glide.with(context)
.load(items.get(pos).getLinks())
.apply(options)
.thumbnail(Glide.with(context).load(R.drawable.loading_back))
.thumbnail(Glide.with(context).load(R.drawable.connection_fail))
.into(holder.imageView);
来自 This and
build.gradle(应用级)
dependencies {
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
}
使用Glide.
Glide.with(context)
.load(imgUrl)
.asGif()
.placeholder(R.drawable.img)
.crossFade()
.into(imageView);