10

My activity contains an AppBarLayout provided by the design library 23.0.1, it hides when I scroll up. I have a RecyclerView with each child item containing a RecyclerView too, basically a nested RecyclerView going on.

My issue is that when I touch on any of the inner RecyclerView's child and scroll up, the AppBar does not hide. However, if I place my finger somewhere else (not on the inner RecyclerView) and scroll, the app bar scrolls up just fine. Why is this happening? I even tried adding the appbar behavior for the inner recycler view, yet the app bar would only scroll up when I touch somewhere else and scroll.

Note: the inner recyclerview has a fixed set of items that would be visible at all times, basically, there is no scrolling within the recyclerview.

There is a similar question and a provided solution would be to intercept the touch of the inner recyclerview and pass it to the parent recycler view. But this disables the click events of the children in the inner recycler view, I do not want that.

4

1 回答 1

20

对于内部回收器视图,您需要将嵌套滚动标志设置为 false。

mSomeInnerRecyclerView.setNestedScrollingEnabled(false);

于 2015-12-16T17:18:42.863 回答