I have a ViewHolder
that contains another RecyclerView
. This type of the ViewHolder
gets reused multiple times.
Since the ViewHolder
is shared between different items, the scroll position of the RecyclerView
is also shared between items. Eg, You scroll to the end of the first item, the fifth item's RecyclerView also gets scrolled to the very end, because the view is reused.
I'm trying to solve this by mapping 1 ViewHolder
to 1 item.
I've tried to set an itemId
for the item, call RecyclerView.ViewHolder#setIsRecyclable(false), and extend/set RecyclerView.getRecycledViewPool().setMaxRecycledViews()
as mentioned in this answer
After I scroll down and scroll back up (The ViewHolder
gets recycled), the scroll position of the inner RecyclerView is reset to the first item.