What is the proper way to save the scroll position in an EpoxyRecyclerView?
See original GitHub issueWhen I use the back button to return to my Fragment (which is only a vertical EpoxyRecyclerView using MvRx) it starts at the top of the list instead of the screen. This is probably annoying for users who click on a photo, see the full screen image, and then end up at the top of the screen when hitting back. Is this something Android should be doing automatically? Should I be storing the scroll position in onSavedInstanceState? Or does Epoxy have some other solution?
I know that I can set saveViewState
on Models, but I don’t see how this would help the RecyclerView resume at the previous scroll position.
Issue Analytics
- State:
- Created a year ago
- Comments:5
Top Results From Across the Web
How to save and restore scrolling position of the RecyclerView ...
I am using a linearlayout for my recyclerview and I've placed my code (myAdapter.setStateRestorationPolicy(RecyclerView.Adapter.
Read more >Saving Scroll Positions of Nested RecyclerViews - Medium
The idea behind this solution is that we will save the current scroll index of each horizontal carousel in some data structure before...
Read more >Epoxy for Android - Airbnb Engineering & Data Science
Additionally, Epoxy adds support for saving view state and automatic diffing ... to specify what layout your model uses and how to bind...
Read more >How to save RecyclerView's scroll position using ... - YouTube
Android : How to save RecyclerView's scroll position using RecyclerView.State?
Read more >SAVED INSTANCE STATE AND RECYCLERVIEW SCROLL ...
This video wraps up the movie app with the use of saved instance state to persist the popular and most rated movie with...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have the same problem ! I use carousel within a vertical RecyclerView+Navigation,but carousel not saved the position.
This is indeed the case. I did the same thing. Although my original method kept the scroll position, the
adapter
leaked. Now if I use this, it is no problem to empty theadapter
when I leave the window, but the original scroll state is gone. I don’t know how to solve it, maybe I can rewrite thenavigation
component to notdestroy
the view when navigating?Just overlay the view. This is the BaseEpoxyFragment I wrote while practicing.