I have some weird issue with RecyclerView
since I changed my app to load the data from Room
database.
I have a screen (a Fragment
In my case this line was culprit,
GridLayoutManager gridLayoutManager = new GridLayoutManager(this, SPAN_COUNT, GridLayoutManager.VERTICAL, true);
Specifically , last parameter which is setting reverseLayout
attribute to true. Make it false
and RecyclerView doesn't scroll to bottom of screen.
Did you try this? Setting descendantFocusability
property of parent RecyclerView
to blocksDescendants.
What this will do is, it will no more focus on your dynamically loaded child views inside recycler view, as a result, the automatic scroll will not take place.
android:descendantFocusability="blocksDescendants"
Note: The property descendantFocusability
can be used with other views as well like FrameLayout, RelativeLayout, etc. So if you set this property to your parent/root layout, it will no more scroll to bottom.