I'm using Glide for setting png images (with transparencies) in ImageView in this mode:
Glide.with(context).load(url)
.crossFade()
.placeholder(R.drawable.no_contest)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into((ImageView)container);
Is it possible to set the backgroundcolor of the image without setting the background color of ImageView ?
thanks
LayerDrawable
should be used:
.into(new SimpleTarget<GlideDrawable>() {
@Override
public void onResourceReady(GlideDrawable resource,
GlideAnimation<? super GlideDrawable> glideAnimation) {
final ShapeDrawable background = new ShapeDrawable();
background.getPaint().setColor("color here");
final Drawable[] layers = {background, resource};
container.setImageDrawable(new LayerDrawable(layers));
}
});
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