I have created an gradient xml
in drawable folder of my project. I want to load that xml
in an ImageView
using Glide
. How can I do that ?
Simple loading of image in ImageView using Glide:
Glide.with(LoginActivity.this).load(R.drawable.a270).asBitmap().diskCacheStrategy(DiskCacheStrategy.RESULT).into(backgroundImage);
But if I use the same code above replacing R.drawable.a270
with R.drawable.gradient_background
with a drawable xml its not working.
Please try this -
Glide.with(LoginActivity.this).load("").error(R.drawable.gradient_background).diskCacheStrategy(DiskCacheStrategy.RESULT).into(backgroundImage);
OR
Glide.with(LoginActivity.this).load(null).fallback(R.drawable.gradient_background).diskCacheStrategy(DiskCacheStrategy.RESULT).into(backgroundImage);
I doubt you are using VectorDrawable
or animated drawable
. Please refer this and this for more information on this.
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