【问题标题】:"Hidden" Toolbar visible under status bar状态栏下可见的“隐藏”工具栏
【发布时间】:2015-10-16 07:00:35
【问题描述】:

向下滚动时使用 CoordinatorLayout 隐藏我的工具栏。

工具栏认为它被隐藏了 - 但事实并非如此。

有人知道为什么会这样吗?

注意:我已将状态栏设置为半透明以拥有合适的材料抽屉。将状态栏设为纯色不是我正在寻找的解决方案 - 当然,除非这就是它的预期用途。

【问题讨论】:

    标签: android android-layout material-design androiddesignsupport


    【解决方案1】:

    我尝试将状态栏颜色设置为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" />
    

    【讨论】:

      【解决方案2】:

      【讨论】:

      • 浏览cheesesquare代码已经有一段时间了;如果我将 android:statusBarColor 设置为透明,仍然有问题。使用折叠工具栏布局来包裹工具栏可以隐藏工具栏,但是如果我没有想要使用的任何特征图像怎么办?
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-07-12
      • 2016-07-03
      • 1970-01-01
      • 2011-10-28
      • 1970-01-01
      • 1970-01-01
      • 2011-04-29
      相关资源
      最近更新 更多