RecyclerView items duplicate and constantly changing

后端 未结 8 2251
遥遥无期
遥遥无期 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

    I had the same problem with a big grid recyclerview with hundreds of numbers that should have appeared sequentially but their order was getting mixed up and repeated.

    // More concise code with Kotlin expressions
    override fun getItemId(position: Int) = position.toLong()
    override fun getItemViewType(position: Int) = position
    

    Added above lines to the adapter.

提交回复
热议问题