Android, Glide shows wrong image for about one second

前端 未结 2 1293
攒了一身酷
攒了一身酷 2021-01-12 15:29

I\'m using Glide library for loading images from URL, which I get from Graph Request (Facebook). It\'s used in RecyclerAdapter. When I\'m scrolling, each ImageView shows wro

2条回答
  •  自闭症患者
    2021-01-12 16:14

    @Override
    public void onBindViewHolder(final RecyclerView.ViewHolder holder, final int position) {
    
        ImageView main_image = viewHolder.main_image,
        main_image.setImageURI(null);
        getEventCover(position, main_image);
    
            }
    

    During the process of (binding) preparing a child view to display data, a (recycled) view previously used to display data is being retrieved from the cache for reuse. As this process skips initial layout inflation and construction, the ImageView noticeably retains it's source. Setting the source to null immediately drastically improves performance.

提交回复
热议问题