默认情况下,当用户从CollapsingToolbarLayout中滚动视图时,NestedScrollView将被折叠或展开。
我怎样才能关闭自动扩张?我想要实现的是一个工具栏,只有调用AppBarLayout::setExpanded才能展开或折叠它。
发布于 2017-10-16 16:00:05
好吧,我找到答案了。为了使工具栏在屏幕上滚动,我们必须创建以下布局层次结构:
<CoordinatorLayout>
<AppBarLayout>
<CollapsingToolbarLayout>
<Toolbar />
</CollapsingToolbarLayout>
</AppBarLayout>
<NestedScrollView>
<!-- content -->
</NestedScrollView>
</CoordinatorLayout>为了关闭此功能(使滚动不会导致工具栏折叠),我们只需将NestedScrollView替换为ScrollView。
https://stackoverflow.com/questions/46773926
复制相似问题