Appcompat 23.2.1抽屉布局,状态栏覆盖导航视图

时间:2016-03-31 14:45:35

标签: android android-appcompat android-styles

我从正常的Light Dark appcompat主题切换到DayNight,现在状态栏颜色正在我的窗口上绘制。改变了什么来破坏我的配置?

styles.xml

<style name="AppThemeDayNight" parent="Theme.AppCompat.DayNight.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/primary</item>
    <item name="colorPrimaryDark">@color/primary_dark</item>
    <item name="colorAccent">@color/accent</item>
    <item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
    <item name="statusViewStyle">@style/StatusViewStyle</item>
</style>

<style name="AppThemeDayNight.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>

<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

样式-v21.xml

    <style name="AppThemeDayNight.NoActionBar">
    <item name="android:windowDrawsSystemBarBackgrounds">true</item>
    <!--<item name="android:statusBarColor">@android:color/transparent</item> -->
    <!--<item name="android:windowTranslucentStatus">true</item> -->
    <item name="android:windowActionModeOverlay">true</item>
</style>


<style name="AppThemeDayNight.NoActionBar.Drawer">
    <item name="android:statusBarColor">@android:color/transparent</item>
</style>

activity_layout.xml

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

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

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/AppTheme.PopupOverlay"
            tools:title="Timeline"/>

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

    <include layout="@layout/content_twitter" />

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="@dimen/fab_margin"
        app:srcCompat="@drawable/ic_menu_send" />

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

<!-- The navigation drawer -->
<android.support.design.widget.NavigationView
    android:id="@+id/navigation"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    app:menu="@menu/activity_main_drawer" />

这是使用导航视图打开的抽屉的屏幕截图,应该在状态栏上绘图。 screenshot

2 个答案:

答案 0 :(得分:0)

添加

 <item name="android:windowContentOverlay">@null</item>

<style name="AppThemeDayNight" parent="Theme.AppCompat.DayNight.NoActionBar"> 

阻止并尝试

答案 1 :(得分:-1)

尝试将windowTranslucentStatus设置为true

<item name="android:windowTranslucentStatus">true</item>