RecyclerView prevents NestedScrollView from minimizing ToolBar

时间:2015-06-30 13:41:49

标签: android android-fragments android-recyclerview androiddesignsupport android-collapsingtoolbarlayout

Hi I used Chris Banes Example(https://github.com/chrisbanes/cheesesquare) app to create this layout. I'm trying to create a similar, but slightly different version of this for my app. While the example has 3 instances of the same Fragment with RecyclerView, my requirement is a RecyclerView Fragment, a NestedScrollView Fragment and another RecyclerView Fragment.

There is no problem if I start scrolling from the NestedScrollView fragment, everything works fine, the ToolBar gets minimized and maximized accordingly. But once I go to the RecyclerView Fragment and comes back, I cannot minimize/maximize the ToolBar. It stays frozen and I have to go back to the RecyclerView Fragment in order to minimize/maximize it.

These are the layouts for the changed files, the rest is the same as in the repo:

http://pastebin.com/zs0krQW3

What could I be doing wrong?

1 个答案:

答案 0 :(得分:0)

如指向here,在recyclerview上使用setNestedScrollingEnabled可以解决问题。它对我有用,但奇怪的是只有程序化版本:

recyclerView.setNestedScrollingEnabled(false);