简体   繁体   中英

How to avoid imageview blink in recyclerview?

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)

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);
        }
    });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM