My structure is looking like that:
<CoordinatorLayout>
<AppBarLayout>
<CollapsingToolbarLayout
app:layout_scrollFlags="scroll|exitUntilCollapsed"
>
...
</CollapsingToolbarLayout>
<TabLayout/>
</AppBarLayout>
<ViewPager/>
</CoordinatorLayout>
ViewPager wraps it's content each time when the page is changed but never takes height more than an available height (like match_parent). The problem in that when ViewPager height is less than the available height the AppBar is collapsing until it is not visible and there is a lot of empty space under the wrapped ViewPager. How can I implement behaviour when the ViewPager is less than content available height do not collapse more than needed?