在android中循环视图中显示重复图像

在android中循环视图中显示重复图像,android,android-recyclerview,Android,Android Recyclerview,在循环视图中,显示的图像有时会重复。显示重复图像的原因是什么?并非每次都显示重复图像 public void onBindViewHolder(ViewHolder holder, int position) { holder.tvSubject.setText(chatSessions.get(position).getName()); holder.tvMessage.setText(chatSessions.get(position).getLastUnre

在循环视图中,显示的图像有时会重复。显示重复图像的原因是什么?并非每次都显示重复图像

public void onBindViewHolder(ViewHolder holder, int position) {
        holder.tvSubject.setText(chatSessions.get(position).getName());
        holder.tvMessage.setText(chatSessions.get(position).getLastUnreadMsg());
        holder.tvTime.setText(chatSessions.get(position).getTime());

        final String pictureLink = ServerRequestHandler.getPictureLink(chatSessions.get(position).getCsToken());

        Log.d("ChatListAdapter", position + ", pictureLink= " + pictureLink);
        Log.d("ChatListAdapter", chatSessions.get(position).getName() + ", Time= " + chatSessions.get(position).getTime());

        holder.profileLoadingView.setVisibility(View.GONE);
        holder.profilePicture.setVisibility(View.VISIBLE);
        holder.profilePicture.setImageDrawable(null);

        if (TaskUtils.isNotEmpty(pictureLink)) {

            imageLoader.displayImage((MainPageActivity) context, pictureLink, holder.profilePicture, holder.profileLoadingView);
        } else {
//            imageLoader.displayImage(null, holder.profilePicture, holder.profileLoadingView);

//            holder.profilePicture.setImageDrawable(context.getResources().getDrawable(R.drawable.photo));


            holder.profilePicture.setImageDrawable(null);
        }
我已经添加了截图

适配器在ViewRecycled(ViewHolder holder)上有回调
您可以使用它停止加载映像,和/或清除已加载映像的缓存。你必须检查你的图像加载库是如何工作的,以及如何操作

将你的屏幕截图发布到此处PictureLink正在链接到另一个图像?这是因为imageloader库,它可以快速缓存图像loading@ArunShankar如何解决这个问题。有什么想法吗?@Christopher yes图片链接不同我不知道如何清除缓存。你能给出示例代码吗?我不知道什么是
imageLoader
。此外,缓存可能不是罪魁祸首-您必须取消此回调中映像的加载。这会造成另一个问题…有其他解决方案吗?