I am looking at the chrisbanes/cheesesquare and I am trying to put TabLayout with a Toolbar inside a CollapsingToolbarLayout, and here is my code
It turns out that since the AppBarLayout extends LinearLayout, you can have two CollapsingToolBarLayouts (extends FrameLayout) in it. What I did was have the first CollapsingToolBarLayout house the contents I wanted to disappear, and gave it the AppBarLayout flag:
app:layout_scrollFlags="scroll|exitUntilCollapsed"
For the second CollapsingToolbarLayout that actually had the tabs, I set it's scroll flags to:
app:layout_scrollFlags="scroll|enterAlways"
The final XML looks like this and it gives me what I want.