在我的 android 应用程序中,我在 RelativeLayout
中构建了一个简单的 ScrollView
!它还有一个 Material Toolbar
。当用户向上滚动时,如何使 Material 工具栏随过渡隐藏,并在用户向下滚动时显示工具栏?这是我的应用程序的 xml 布局结构。
<RelativeLayout>
<AppBarLayout>
<Toolbar/>
</AppBarLayout>
<ScrollView>
<!-- views -->
</ScrollView>
</RelativeLayout>
最佳答案
使用带有 CollapsingToolbarLayout 的 NestedScrollView
<android.support.v4.widget.NestedScrollView ...>
<LinearLayout ...>
...
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
关于android - ScrollView 滚动时如何隐藏和显示 Material 工具栏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32675688/