Image View is flickering
When i load image from cache at the time image view is flickering my code is below:
Glide.with(mContext)
.load(path)
.asBitmap()
// .dontTransform()
// .animate(R.anim.activity_fade_in)
// .dontAnimate()
.signature(new StringSignature(noteBook.getLastModifiedDate().toString()))
.placeholder(bitmapDrawable)
.skipMemoryCache(false)
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
.into(new BitmapImageViewTarget(imageView) {
@Override
public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
super.onResourceReady(resource, glideAnimation);
imageView.setVisibility(View.VISIBLE);
imageView.setScaleX(1);
imageView.setScaleY(1);
}
});
Please reply me ASAP . Thanks advance
Happens to me too. The loading flickers the background of the ImageView to white. I do have other colors for my placeholders before it loads the image.
The default animation is crossfade, which uses the placeholder as source. @karun2189 can you please also show the XML and other interactions to imageView?
The ImageView should be visible when you start a Glide load to get the size, that may cause a problem too. I see the override, but it's still worth a try without the visibility and scale changes?
Can you guys use adb screenrecord to share what you see? You can use an online service like ezgif to convert mp4 to gif which can be attached to GitHub.
It sounds like you may have too many large images on screen to fit in the memory cache? And you're invalidating your data and re-triggering loads, causing cache misses and flickering.
Consider not using Target.SIZE_ORIGINAL? You're probably loading much larger images than you actually need.
Thanks , Its working fine!!!!!!