nested scrollview + recyclerview, strange autoscroll behaviour [duplicate] nested scrollview + recyclerview, strange autoscroll behaviour [duplicate] android android

nested scrollview + recyclerview, strange autoscroll behaviour [duplicate]


We have a similar problem. We have a vertical RecyclerView. Each item of this vertical RecyclerView contains an horizontal RecyclerView, like in the Android TV app.

When we upgraded the support libs from 23.4.0 to 24.0.0 the automatic scroll suddenly appeared. In particular, when we open an Activity and we then go back, the vertical RecyclerView scrolls up so that the current horizontal RecyclerView row does not get cut and the row is displayed completely.

Adding android:descendantFocusability="blocksDescendants" fixes the issue.

However, I've found another solution, which also works. In our case the vertical RecyclerView is contained inside a FrameLayout. If I add android:focusableInTouchMode="true" to this FrameLayout, the problem goes away.

There's even a third solution mentioned here, which basically consists on calling setFocusable(false) on the child/inner RecyclerViews. I haven't tryied this.

By the way, there is an open issue on the AOSP.


setandroid:focusableInTouchMode="true" for child Layout( may be LinearLayout ) of NestedScrollView