Kevin Grant Kevin Grant - 2 months ago 20
Android Question

Android prevent nested recyclerview from automatically repositioning

I have a ViewPager as an item in a Linear Layout, with each item in the view pager containing a RecyclerView. The problem is, whenever the page initially loads, or when I change pages on the ViewPager, the view automatically scrolls so the beginning of the recycler view is the top of the screen, rather than staying how it is.

A .gif of the issue is here. Note I am not scrolling down, that is the automatic repositioning.

How can I prevent the view from automatically repositioning to the start of the recycler view?


you can add this attribute to your linear layout. The Linear Layout direct child of your scrollView.