Home > Blockchain >  How to avoid imageview blink in recyclerview?
How to avoid imageview blink in recyclerview?

Time:10-07

I am using Recyclerview with some imageview view . Problem is that image is always blink when i refresh Recyclerview. I tried using stableID but it doesn't work as i have a model class where id is in String format. I am using glide to load image into imageview. Please help me out to avoid imageview blinking.

  Glide.with(activity.requireActivity())
                            .load(o.picture).placeholder(R.drawable.user_icon)
                            .dontAnimate()
                            .apply(RequestOptions.bitmapTransform(BlurTransformation()))
                            .into(contact_img)

CodePudding user response:

Could you try to use SimpleTarget

Glide
    .with(context)
    .load(filepath)
    .asBitmap()
    .diskCacheStrategy(DiskCacheStrategy.NONE)
    .skipMemoryCache(true)
    .dontAnimate()
    .into(new SimpleTarget<Bitmap>() {
        @Override
        public void onResourceReady(Bitmap arg0, GlideAnimation<? super Bitmap> arg1) {
            // TODO Auto-generated method stub
            holder.mItemView.setImageBitmap(arg0);
        }
    });
  • Related