我一直在調試它很長一段時間,似乎無法找到解決方案。我的問題是我的狀態欄是白色的,即使當我用xml線看到我的視圖時 android:fitsSystemWindows="true"
Android:StatusBar在設置了適合系統窗口和工具欄的白色後,出現了一個primaryDarkColor
問題的圖片可以在下面找到。無論如何,我嘗試過多種解決方案,但都沒有成功。這是我的工具欄的代碼。
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.AppBarLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:elevation="3dp"
>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/AppTheme.ActionBarStyle"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/actionbar_color"/>
</android.support.design.widget.AppBarLayout>
這裏是AppTheme.ActionBarStyle
<style name="AppTheme.ActionBarStyle" parent="Widget.AppCompat.Toolbar">
<item name="android:background">@color/actionbar_color</item>
<item name="popupTheme">@style/ThemeOverlay.AppCompat.Light</item>
<item name="theme">@style/ThemeOverlay.AppCompat.Light</item>
</style>
代碼這是問題的圖片。我在這裏錯過了什麼?另外請注意,我沒有在apptheme設置顏色
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Set AppCompat’s color theming attrs -->
<item name="colorPrimary">@color/primary</item>
<!-- darker variant for the status bar and contextual app bars -->
<item name="colorPrimaryDark">@color/primary_dark</item>
<!-- theme UI controls like checkboxes and text fields -->
<item name="colorAccent">@color/accent</item>
</style>
爲什麼不使用''item name =「android:statusBarColor」> @ color/someColor'? –
因爲這目前沒有工作。 –