CollapsingToolbarLayout: Keep Toolbar but hide TabLayout with quick return

淺唱寂寞╮ 提交于 2019-12-12 14:22:31

问题


I want the Toolbar to always be visible and have the TabLayout get scrolled away and quick return but this combination seems impossible.

<CoordinatorLayout>
    <AppBarLayout>
        <CollapsingToolbarLayout layout_scrollFlags="scroll|exitUntilCollapsed">
            <TabLayout/>
            <Toolbar layout_collapseMode="pin" />
        </CollapsingToolbarLayout>
    </AppBarLayout>
    <ViewPager/>
</CoordinatorLayout>

This makes my Toolbar not scroll away, but it makes the TabLayout only return when scrolled to the top of the list.

Changing to scroll|enterAlwayson the CollapsingToolbarlayout makes the Toolbar scroll away too.


回答1:


A solution was to have the CollapsingToolbarLayout have these scroll flags.

app:layout_scrollFlags="scroll|exitUntilCollapsed|enterAlways"

But the shadow is missing..



来源:https://stackoverflow.com/questions/39142960/collapsingtoolbarlayout-keep-toolbar-but-hide-tablayout-with-quick-return

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!