1

i have both style file in Application and it is not getting colorPrimaryDark as a Statusbar color. i am checking with Nexus 6 and it is not working in it.is something i am missing.

enter image description here

style.xml

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>


    </style>


</resources>

style.xml(v21)

<resources>

    <!-- Base application theme. -->
    <!--Application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="android:windowDrawsSystemBarBackgrounds">false</item>
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
        <!--All customizations that are NOT specific to a particular API-level can go here. -->
    </style>


</resources>

Menifest - there is no theme define in any activity

<application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

color file

<color name="colorPrimary">#35734F</color>
    <color name="colorPrimaryDark">#35734F</color>
    <color name="colorAccent">#D2AB67</color>
9spl
  • 357
  • 1
  • 11

2 Answers2

1

Try adding <item name="android:windowDrawsSystemBarBackgrounds">true</item> and <item name="android:statusBarColor">@android:color/transparent</item> in your style.xml(v21).

style.xml

<resources>

    <!-- Base application theme. -->
    <style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>

    <style name="AppTheme" parent="AppBaseTheme">

</resources>

style.xml(v21)

<resources>

    <!-- Base application theme. -->
    <!--Application theme. -->
    <style name="AppTheme" parent="AppBaseTheme">
        <item name="android:windowDrawsSystemBarBackgrounds">true</item>
        <item name="android:statusBarColor">@android:color/transparent</item>
    </style>

</resources>
Ferdous Ahamed
  • 21,438
  • 5
  • 52
  • 61
  • And you may want to take a look at this link if some of your activities' status bar turn to white : https://stackoverflow.com/a/38182815/3121246 – Wei WANG Sep 04 '17 at 01:09
0

change parent to "Theme.AppCompat.Light.NoActionBar"

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>

</style>

</resources>
G.S Kulkarni
  • 107
  • 4