Hi there,
I have code like this
GlideApp.with(context)
.load(url)
.transition(withCrossFade())
.diskCacheStrategy(DiskCacheStrategy.ALL)
.placeholder(R.color.placeholder)
.into(imageView);
I guess after it loads transparent image, instead of replacing placeholder, it puts image in front of placeholder.
This is expected behavior. See https://github.com/bumptech/glide/issues/1990
Hi Christopher,
Thanks for reply!
Can you please provide an example. Not sure where should I pass DrawableCrossFadeFactory from the doc.
DrawableCrossFadeFactory factory =
new DrawableCrossFadeFactory.Builder().setCrossFadeEnabled(true).build();
@minas90 "you can enable cross fades by adjusting the options in DrawableCrossFadeFactory and passing the result into transition()." - at the end of http://bumptech.github.io/glide/doc/transitions.html#cross-fading-with-placeholders-and-transparent-images
so it should be new DrawableTransitionOptions().withCrossFade(factory) and this options object goes into http://bumptech.github.io/glide/javadocs/400/com/bumptech/glide/RequestBuilder.html#transition-com.bumptech.glide.TransitionOptions-
But since you're using GlideApp I think you can skip the options and replace withCrossFade() in OP with your factory.
Hi Robert,
I tried to replace withCrossFade() with factory as I understood from the doc, but transition accepts TransitionOptions and complains about DrawableCrossFadeFactory.

And as withCrossFade is static, my final code is as follows
DrawableCrossFadeFactory factory =
new DrawableCrossFadeFactory.Builder().setCrossFadeEnabled(true).build();
GlideApp.with(context)
.load(url)
.transition(withCrossFade(factory))
.diskCacheStrategy(DiskCacheStrategy.ALL)
.placeholder(R.color.placeholder)
.into(imageView);
I think it will be great to write about it in the doc and maybe add some code snippet as it's not so straightforward to understand until you dig into the source.
I had a similar problem.
The solution was indeed harder than expected to find.
Thanks for this.
Hello,
Thanks alot for the solution. Really helped me with my code.
Most helpful comment
Hi Robert,

I tried to replace withCrossFade() with factory as I understood from the doc, but transition accepts TransitionOptions and complains about DrawableCrossFadeFactory.
And as withCrossFade is static, my final code is as follows
I think it will be great to write about it in the doc and maybe add some code snippet as it's not so straightforward to understand until you dig into the source.