I want to save the position of my RecyclerView, then reset it later. If the top item is only halfway visible, what do I use to save this offset?
For the position I am using: findFirstCompletelyVisibleItemPosition()
To reset the position I am using:
((LinearLayoutManager) recyclerView.getLayoutManager()).scrollToPositionWithOffset(position, offset);
But I am not sure what to pass as the offset?
You must use LinearLayoutManager as this..
LinearLayoutManager manager = (LinearLayoutManager) recyclerView.getLayoutManager();
int position = manager.findFirstVisibleItemPosition();
View firstItemView = manager.findViewByPosition(position);
float Offset = firstItemView.getTop();
And get the position and offset of first item in current window.