2017-04-24 5 views
0

リサイクルビューでは、画像が重複して表示されることがあります。重複image.Notを表示する理由は何ですかscreennはあなたがイメージのロードを停止するために使用することができ enter image description here重複した画像がアンドロイドのリサイクルビューに表示されます

+0

ここにあなたのスクリーンショットを投稿 –

+0

画像リンクは別の画像にリンクしていますか? – Christopher

+0

それはimageloaderライブラリのために、それは高速ロードのための画像をキャッシュします –

答えて

0
アダプタ

がコールバックonViewRecycled(ViewHolder holder)を持って撮影し、私が追加した

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

いつかそのoccureすべての時間、および/または既にローダ画像のキャッシュをクリアすることができる。画像ローディングライブラリの仕組みと操作方法を確認する必要があります

+0

私はキャッシュをクリアする方法について考えていません。あなたは 'imageLoader'が何であるかわからないので、いいえ、サンプルコード –

+0

いいえできますか?また、キャッシュは原因ではないかもしれません - このコールバックで画像のロードを取り消す必要があります – X3Btel

+0

その別の問題を作成...他の解決策? –

関連する問題