向下滚动时使用 CoordinatorLayout 隐藏我的工具栏。
工具栏认为它是隐藏的 - 但它不是。
有人知道为什么会这样吗?
注意:我将状态栏设置为半透明,以便有合适的 Material 抽屉。将状态栏设为纯色不是我正在寻找的解决方案 - 当然,除非这就是它的用途。
最佳答案
我尝试将状态栏颜色设置为primarydark,然后打开抽屉时状态栏不能透明,否则工具栏会再次出现。
经过两天的工作,我发现如果我在 CoordinatorLayout 中删除 android:fitsSystemWindows="true"
,它就解决了。
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<-- CoordinatorLayout is root of @layout/app_bar_home-->
<include
layout="@layout/app_bar_home"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_home"
app:menu="@menu/activity_home_drawer" />
关于android - "Hidden"状态栏下可见工具栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33164337/