I got this solution from @pskink:
recylerView.setLayoutManager(new LinearLayoutManager(this) { @Override public boolean requestChildRectangleOnScreen(RecyclerView parent, View child, Rect rect, boolean immediate) { return false; } });
It seems to work fine, but @pskink mentioned that this could have problems using the arrow keys. He posted another solution here: https://pastebin.com/8JLSMkF7 . If you have problems with the above solution, you can try the alternative solution by reference. At the moment, I stick to the one I just posted here.
UPDATE
Using the v25.3.0 support library, you must also override another requestChildRectangleOnScreen method in the LayoutManager:
@Override public boolean requestChildRectangleOnScreen(RecyclerView parent, View child, Rect rect, boolean immediate, boolean focusedChildVisible) { return false; }
source share