Question

I'm trying to theme my Action Bar. When I apply my theme, the preview (in Android Studio) renders it correctly, but at runtime on a device the Action Bar is completely missing.

My values/styles.xml file:

<resources>
    <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
        <item name="android:windowBackground">@color/background_gray</item>
        <item name="android:actionBarStyle">@style/GreenActionBar</item>
    </style>
    <style name="AppTheme" parent="AppBaseTheme"/>

    <style name="GreenActionBarBase">
        <item name="android:background">#00c341</item>
    </style>

    <style name="GreenActionBar" parent="GreenActionBarBase"/>    

</resources>

Preview:

Preview

Runtime:

Runtime

What am I missing?

Was it helpful?

Solution

<resources>
    <style name="AppBaseTheme" parent="@style/Theme.Holo.Light">
        <item name="android:windowBackground">@color/background_gray</item>
        <item name="android:actionBarStyle">@style/GreenActionBar</item>
    </style>
    <style name="AppTheme" parent="AppBaseTheme"/>

    <style name="GreenActionBarBase" parent="@style/Widget.THE_STYLE_YOU_WANT">
        <item name="android:background">#00c341</item>
    </style>

    <style name="GreenActionBar" parent="GreenActionBarBase"/>    

</resources>

Check the answer. I think you need to have a parent for the GreenActionBarBase.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top