RecyclerView items duplicate and constantly changing

后端 未结 8 2236
遥遥无期
遥遥无期 2020-12-13 04:14

What\'s Happening:

The list (RecyclerView) is mixing up the data when I scroll.

I.E when I scr

8条回答
  •  失恋的感觉
    2020-12-13 05:14

    In kotlin with clearing the previous items from the LinearLayout list item from the RecyclerView

    override fun onBindViewHolder(view: MyViewHolder, index: Int) {
            view.guideLinearLayout.removeAllViews()
    /* do binding here*/
    }
    
    override fun getItemId(position: Int): Long {
           return position.toLong()
    }
    
    override fun getItemViewType(position: Int): Int {
           return position
    }
    

提交回复
热议问题