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

后端 未结 3 655
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:13

    I had the same problem and I don't know why is happening.

    I solved it removing the android:animateLayoutChanges on the recyclerview and to animate the recyclerview I have added: recyclerView.setItemAnimator(new DefaultItemAnimator());

    Take an account to add the method public long getItemId(int position) and set setHasStableIds(true) if you want animate it.

提交回复
热议问题