Search code examples
androidandroid-layoutandroid-fragmentsandroid-toolbarandroid-collapsingtoolbarlayout

CollapsingToolbar doesn't fully collapse


I have a Navigation Drawer Activity (NavActivity) in which one of the fragments (OuterFrag.xml) has a Collapsing Toolbar and a View Pager. When I scroll in the View Pager(InnerFrag.xml), the toolbar collapses, but not fully. Here's the image and the code before I go any further..

The part in red should be completely gone!

OuterFrag.xml

InnerFrag.xml

The problem has to be in OuterFrag, which contains the CollapsingToolbar. I've tried setting the height of the CollapsingToolbar to "1dp", but then a black Toolbar appears with the same size of the red are in the image above!


Solution

  • Found the solution!

    I removed the android:fitsSystemWindows="true" from the CoordinatorLayout and the AppBarLayout and now, the Toolbar collapses completely!