【发布时间】:2015-10-16 07:00:35
【问题描述】:
向下滚动时使用 CoordinatorLayout 隐藏我的工具栏。
工具栏认为它被隐藏了 - 但事实并非如此。
有人知道为什么会这样吗?
注意:我已将状态栏设置为半透明以拥有合适的材料抽屉。将状态栏设为纯色不是我正在寻找的解决方案 - 当然,除非这就是它的预期用途。
【问题讨论】:
标签: android android-layout material-design androiddesignsupport
向下滚动时使用 CoordinatorLayout 隐藏我的工具栏。
工具栏认为它被隐藏了 - 但事实并非如此。
有人知道为什么会这样吗?
注意:我已将状态栏设置为半透明以拥有合适的材料抽屉。将状态栏设为纯色不是我正在寻找的解决方案 - 当然,除非这就是它的预期用途。
【问题讨论】:
标签: android android-layout material-design androiddesignsupport
我尝试将状态栏颜色设置为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" />
【讨论】:
【讨论】: