glide icon indicating copy to clipboard operation
glide copied to clipboard

Image View is flickering

Open thizisarun opened this issue 11 years ago • 4 comments

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

thizisarun avatar Sep 24 '15 15:09 thizisarun

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.

ehanoc avatar Sep 24 '15 23:09 ehanoc

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.

TWiStErRob avatar Sep 25 '15 10:09 TWiStErRob

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.

sjudd avatar Sep 30 '15 16:09 sjudd

Thanks , Its working fine!!!!!!

thizisarun avatar Oct 01 '15 06:10 thizisarun