I try to show a GIF image as loading placeholder in image view - with Glide Library:
Glide.with(context) .load(ImageUrl()) .placeholder(R.drawable.loading2) .asGif() .crossFade() .into(image);
I try to show this file
loading2.gif
but get this error :
Error:(54, 86) error: cannot find symbol method asGif()
How can I show GIF file with Glide in a imageView?
Glide is an Image Loader Library for Android developed by bumptech and is a library that is recommended by Google. It has been used in many Google open source projects including Google I/O 2014 official application. It provides animated GIF support and handles image loading/caching.
The above answer didn't work for me. The below code works.
ImageView imageView = (ImageView) findViewById(R.id.imageView); GlideDrawableImageViewTarget imageViewTarget = new GlideDrawableImageViewTarget(imageView); Glide.with(this).load(R.raw.sample_gif).into(imageViewTarget);
For Glide 4.+
ImageView imageView = (ImageView) findViewById(R.id.imageView); Glide.with(this).asGif().load(R.raw.image_gif).into(imageView);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With