Save Group scroll position state after data set change
You don't have to do anything special for Groupie. You can just use the normal methods you would with any RecyclerView with a LinearLayoutManager or GridLayoutManager.
To save state:
int scrollPosition = layoutManager.findFirstVisibleItemPosition()
To restore state:
layoutManager.scrollToPosition(scrollPosition)
@lisawray thanks!
Using the above method if you have more items on your group the view will snap to start of the group. To overcome this you could use layoutManager.onSaveInstanceState()
To save state:
Parcelable layoutManagerState = layoutManager.onSaveInstanceState();
To restore state:
layoutManager.onRestoreInstanceState(layoutManagerState);
Kudos
Most helpful comment
You don't have to do anything special for Groupie. You can just use the normal methods you would with any RecyclerView with a LinearLayoutManager or GridLayoutManager.
To save state:
int scrollPosition = layoutManager.findFirstVisibleItemPosition()To restore state:
layoutManager.scrollToPosition(scrollPosition)