sejn
sejn

Reputation: 2664

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);

Upvotes: 0

Views: 2242

Answers (2)

sejn
sejn

Reputation: 2664

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);
         }
     });

Upvotes: 1

Nikhil Ranjan
Nikhil Ranjan

Reputation: 56

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

if asGIF() didn't work then

use this library GIFPLAYER

Upvotes: 0

Related Questions