0
リストビュー(カードビュー)の各行に、私はscroolビュー(ダイナミックビュー)にいくつかのビュー(ダイナミックビュー)を追加する水平スクロールビューを1つ持っているリストビューを開発しています1つのビューが1つずつ表示されます) しかし、私がscroolをダウンすると、アダプターはscroolビューで余分なビューを追加します(2つのビューを追加する必要があります。 )RecyclerViewに動的にビューを追加する
この問題の管理方法はわかりません。
マイコード:
@Override
public void onBindViewHolder(SicknessResulteHolder holder, int position) {
//Use the provided View Holder on the onCreateViewHolder method to populate the current row on the RecyclerView
/**********************************************************************************************************/
List<String> user_symptoms = new ArrayList<String>();
for (int i = 0 ; i<frag_recognize_1.list.size() ; i++){
for (int j = 0 ; j< list.get(position).user_symptoms.size() ; j++){
if (list.get(position).user_symptoms.get(j) == frag_recognize_1.list.get(i).getSymptoms_id()){
user_symptoms.add(frag_recognize_1.list.get(i).getTitle());
}
}
}
/**********************************************************************************************************/
if (list.get(position).addView){
for (int i = 0 ; i < list.get(position).user_symptoms.size() ; i++){
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
LinearLayout linearLayout = (LinearLayout) inflater.inflate(R.layout.symptoms_row,null,false);
TextView textView = (TextView) linearLayout.findViewById(R.id.textView);
textView.setText(String.valueOf(user_symptoms.get(i)));
textView.setTextColor(Color.WHITE);
holder.scrollSymptoms.addView(linearLayout);
}
list.get(position).setAddView(false);
}
}
大変お手数ですが、問題は解決しました。私はこの方法に自分のコードを入力する必要があります –