I want to show gif on Glide error() in recycler Adapter. how should I do that?
I want to show a picture in Glide, and when the internet will be disconnected, I'll show a Gif, but Glide Gif will not show. here is my glide code that just shows loading_back.gif and didn't show 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);
build.gradle(app-level)
dependencies {
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
}
Use of Glide.
Glide.with(context)
.load(imgUrl)
.asGif()
.placeholder(R.drawable.img)
.crossFade()
.into(imageView);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.