George B George B - 8 months ago 36
Android Question

Why is my Custom Action Bar White, and not the Specified Color?

I am creating an Android app, and I have customized my action bar using this code-



<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">

<style name="Theme.Base" parent="AppTheme">
<item name="android:textColorPrimary">#f1f1f1</item>
<item name="colorPrimary">@color/notesPrimaryBackgroundColor</item>
<item name="colorPrimaryDark">@color/notesSecondaryBackgroundColor</item>
<item name="colorAccent">@color/notesColorBackgroundAccent</item>
<item name="windowActionBar">true</item>
<item name="android:windowNoTitle">false</item>
<item name="android:windowBackground">@color/notesBackgroundColor</item>



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

<color name="notesPrimaryBackgroundColor">#009688</color>
<color name="notesSecondaryBackgroundColor">#004D40</color>
<color name="notesColorBackgroundAccent">#FF9922</color>
<color name="notesBackgroundColor">#FAFAFA</color>
<color name="notesPrimaryTextColor">#FAFAFA</color>
<color name="notesBody">#FAFAFA</color>
<color name="notesCardBody">#EBEBEB</color>
<color name="notesSecondaryTextColor">#656565</color>
<color name="notesDropBoxSeparator">#C1C1C1</color>
<color name="notesSelectionTickColor">#455EDE</color>
<color name="notesImageBackground">#C1C1C1</color>

I selected Theme.Base as the theme in the Android Manifest, and the action bar color shows up in the designers, but when I run my app on my Samsung tablet, the action bar is white, and everything else is normal. Could this be because I specified the action bar color somewhere else as well, or is it because I didn't specify it's color correctly? Any other ideas? Thanks- George


Update the code

<style name="Theme.Base" parent="Theme.AppCompat.Light">

hope that helps.


<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"></style>

and you made this guy parent of your app theme which in turn forces it to have no action bar.