When i scroll my recyclerview too fast i am getting the following crash
java.lang.IllegalArgumentException: Scrapped or attached views may not be recycled.
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.
Have you tried layoutManager.setItemPrefetchEnabled(false);
? It worked for me.
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.