Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Glide gif doesnt play

I want to load a gif into an imageview, it is displayed but doesn't start playing. I use this code:

Glide.with(context)
             .load("https://media.giphy.com/media/7rj2ZgttvgomY/giphy.gif")
             .into(imageView)

I've also tried adding .asGif() but in that case image is not displayed at all. I'm using glide 3.8.0

like image 334
aloj Avatar asked Sep 05 '25 03:09

aloj


2 Answers

In my case I had set the imageview dimensions to match_parent and specifying it in dp did it for me.

Not sure why exactly match_parent doesn't work in a dialog, playing GIFs, probably something to do with the scaling, if this is the case then using scaleType:fitXY should work too

like image 129
Oush Avatar answered Sep 07 '25 22:09

Oush


try this.

Glide.with(context)
    .load(imageUrl)
    .asGif()
    .placeholder(R.drawable.loading2)
    .crossFade()
    .into(imageView);
like image 25
Mehul Kabaria Avatar answered Sep 07 '25 22:09

Mehul Kabaria