GapWorker with Scrapped or attached views may not be recycled. isScrap:false isAttached:true

后端 未结 3 659
Happy的楠姐
Happy的楠姐 2021-01-18 03:56

When i scroll my recyclerview too fast i am getting the following crash

 java.lang.IllegalArgumentException: Scrapped or attached views may not be recycled.          


        
3条回答
  •  春和景丽
    2021-01-18 04:01

    In my case the problem was because of the incorrect implementing of this method public long getItemId(int position) (overrided from RecyclerView.Adapter method).

    The old code will get two different ids for the same item (in my case it is the footer item), after fixing the implementation the issue has gone.

提交回复
热议问题