我从正常的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" />
答案 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>