Skip to content Skip to sidebar Skip to footer

Set Gif Image To Custom Imageview

I have custom ImageView for animated GIF image. i want to show GIF image, I tried but in this case it is contain url in Async instead I want to show GIF image from raw folder witho

Solution 1:

I had to play and pause the Gif image Glide - Cannot stop gif onClick- Getting TransitionDrawable instead of Animate/GifDrawable

The idea is to get drawable from view,checking if it is an instance of Gifdrawable and playing and pausing it.(Hoping the gif image is already playing)

Add this In OnClick of GifImageView

Drawabledrawable= ((ImageView) v).getDrawable();
if (drawable instanceof GifDrawable) {
         GifDrawableanimatable= (GifDrawable) drawable;
         if (animatable.isRunning()) {
                 animatable.stop();
         } else {
                animatable.start();
         }
}

Post a Comment for "Set Gif Image To Custom Imageview"