RecyclerView adds items multiple times

前端 未结 1 1708
挽巷
挽巷 2020-12-22 05:24

I use a RecyclerView with a CardLayout and the CardLayout contains multiple components. For filling the RecyclerView I us

相关标签:
1条回答
  • 2020-12-22 06:20

    The problem was in the onBindViewHolder method the focus was set, so when I remove the focus code it works.

    @Override
    public void onBindViewHolder(TodoViewHolder holder, int position) {
         holder.cbDone.setChecked(todos.get(position).isChecked());
         holder.tvDescription.setText(todos.get(position).getDescription());
    
         // Remove the following code
         // if(holder.tvDescription.requestFocus()) {
         //    window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
         // }
    }
    
    0 讨论(0)
提交回复
热议问题