Answer the question
In order to leave comments, you need to log in
Why does RecyclerView keep its scroll position when the screen is rotated?
There is data for the list, stored in LiveData in the ViewModel. The activity receives data from there and sets it to the adapter (and when creating the adapter, an empty list is passed to it).
The scroll position of the list remains the same as it was at the beginning, although I did nothing specifically for this.
Why is this happening?
Answer the question
In order to leave comments, you need to log in
Because the recycler, like any normal view, can save its state. The layout manager has special methods for this even.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question