在 Android Kitkat 4.4 版本中使用状态栏下的导航抽屉时状态栏颜色显示白色不透明

status bar colour shows white not transparent while using navigation drawer under status bar in Android Kitkat 4.4 version

我正在使用 material 设计导航抽屉,我想在 android kitkat 4.4 版本中使我的抽屉布局处于透明状态栏下,为此我使用了 fitsystemwindow true 但是当使用 fitsystem window true 它显示白色状态栏我也在我的 style.xml 中使用 android:windowTranslucentStatus true 和 android:windowTranslucentNavigation false under values-v19 但它仍然显示白色状态栏android kitkat 4.4 我知道状态栏很容易在 lolipop 中实现,所以如何在 android kitkat 4.4 中使状态栏透明我已经谷歌搜索了很多但没有解决方案适用于 me.please 帮我提前解决这个问题issue.Thanks。

values-v19/style.xml

 <resources xmlns:android="http://schemas.android.com/tools">

        <!-- Base application theme. -->
        <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
            <!-- Customize your theme here. -->
            <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
            <item name="colorPrimary">@color/colorPrimary</item>
            <item name="android:windowTranslucentStatus">true</item>
            <item name="android:windowTranslucentNavigation">false</item>


        </style>

    </resources>

activity_main.xml

 <?xml version="1.0" encoding="utf-8"?>

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <android.support.design.widget.CoordinatorLayout
        android:id="@+id/coordinator"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:paddingTop="5dp"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="?attr/colorPrimary"
                android:theme="@style/ThemeOverlay.AppCompat.Dark" />

            <android.support.design.widget.TabLayout
                android:id="@+id/tablayout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="?attr/colorPrimary"
                android:theme="@style/ThemeOverlay.AppCompat.Dark"
                app:tabGravity="fill"
                app:tabIndicatorColor="#f8f880"
                app:tabSelectedTextColor="#ff8800"
                app:tabTextColor="#ffffff" />

            <android.support.v4.view.ViewPager
                android:id="@+id/viewpager"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />

        </LinearLayout>

        <android.support.design.widget.FloatingActionButton
            android:id="@+id/fab"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_gravity="bottom|right"
            android:layout_marginBottom="@dimen/activity_vertical_margin"
            android:layout_marginRight="@dimen/activity_horizontal_margin"
            android:src="@drawable/ic_done" />

    </android.support.design.widget.CoordinatorLayout>


    <android.support.design.widget.NavigationView
        android:id="@+id/navigation_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="#ffffff"
        app:headerLayout="@layout/drawer_header"
        app:menu="@menu/drawer" />
</android.support.v4.widget.DrawerLayout>

对于API 21+

<style name="AppTheme" parent="android:Theme.Holo.NoActionBar.TranslucentDecor">
    ...
</style>

对于API级别19+

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="android:windowTranslucentStatus">true</item>
</style>

另外你的布局应该有 android:fitsSystemWindows="false"

注意:在 Android KitKat 中,您不能更改状态栏的颜色,除非您使用以下解决方案,因为只有在 Lollipop Google 中引入了属性 statuBarColor

所以你需要检查这个 transparent status bar in KITKAT