简体   繁体   中英

How to load gif from the drawable in glide v4.11.0 (asGif() method is not resolved)

I need to load a Gif from the drwable folder in my image view. How can i show this in glide 4.11.0 version?

Also, note asGif method can't able to resolve.

Glide
   .with(this)
   .load(R.drawable.run).asGif()
   .into(mGifImage);
Glide
   .with(this)
   .asGif()
   .load(R.drawable.run).asGif()
   .into(mGifImage);

if asGIF() didn't work then

use this library GIFPLAYER

Worked using the below

Glide.with(itemView.getContext())
    .asGif()
    .load(thumbPath)                             
    .placeholder(ResourcesCompat.getDrawable(context.getResources(), 
                     R.drawable.image_loading_placeholder, null))
    .centerCrop()
    .into(new ImageViewTarget<GifDrawable>(imageView) {
         @Override
         protected void setResource(@Nullable GifDrawable resource) {
             imageView.setImageDrawable(resource);
         }
     });

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM