-
Notifications
You must be signed in to change notification settings - Fork 6.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Turn off blinking when loading into ImageView. #755
Comments
The best answer looks like: use a GIF for animation. The blinking comes from Glide setting the Note: you shouldn't use |
Can you elaborate on this for Glide 4.0.0? I changed your code from #527 to: Glide.with(mContext)
.asDrawable()
.load(imagedata)
.thumbnail(Glide.with(mContext)
.asDrawable()
.load(oldImagedata))
.listener(new RequestListener<Drawable>() {
@Override
public boolean onLoadFailed(GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
return false;
}
@Override
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
if (isFirstResource) {
return false; // thumbnail was not shown, do as usual
}
return new DrawableCrossFadeFactory()
.build(DataSource.LOCAL, false) // force crossFade() even if coming from memory cache
.transition(resource, (Transition.ViewAdapter) target);
}
})
.into(imgView); And it's not helping at all, the images still blink and flicker. Is this a desired behavior, why is a no-flicker-policy default? |
The flickering is caused by you loading images into the same view in quick succession. That's not resource (CPU, memory, battery) friendly and hence not the main focus of Glide. Try to add Above you said you're using 3.6.1. I hope it's clear that 4.0 is not released yet so there may be bugs. Can you please try what you're doing in 3.6.1 if adding the transformation doesn't help? |
@TWiStErRob I'm somebody else, with a similar problem as OP. I created a No-Flicker-Target such that the |
Hmm, sorry about confusing you with OP. The problem with The right way is to let that Bitmap go, either by copying it, or "re-loading" it quickly via Glide. This thumbnail trick relies on the fact that The possible fix I suggested still stands: you must match the transformation inside thumbnail to the outside one. Currently the thumbnail load has an implicit If it still doesn't work, enable logging and check what's the difference between the "real old cache key" and the "thumbnail old cache key". Even if it works, you should play around with your current code to see the difference, it's a useful tool in your toolbox of debugging. I would also suggest commenting the |
Thank you, I'll try. |
Thank you! |
I'm using
compile 'com.github.bumptech.glide:glide:3.6.1
this way, loading local drawables into imageViews
infact it works faster then
setImageDrawable()
but it's giving blinking effect. ImageViews changing every 300ms and when I usesetImageDrawable()
there is no such effect. How to avoid it?The text was updated successfully, but these errors were encountered: