Search code examples
androidlayoutandroid-actionbar-compat

ActionBar background using appCompat does not showing


I have:

Background: http://pastebin.com/Un6FQG98

Style whith theme calling background: http://pastebin.com/SNtBJr8N

AndroidManifest calling theme: http://pastebin.com/v4QmUbVt

And activity extends ActionBarActivity.

apparently everything is correct and yet not appear the background. when setted via java code, it works normally.


Solution

  • To support higher APIs as well as older ones you need to also use android::

    <style name="Theme.Actionbarlogin" parent="@style/Theme.AppCompat.Light">
        <item name="android:actionBarStyle">@style/ActionBar.Solid.Actionbarlogin</item>
        <!--Support older APIs-->
        <item name="actionBarStyle">@style/ActionBar.Solid.Actionbarlogin</item>
    </style>
    
    <style name="ActionBar.Solid.Actionbarlogin" parent="@style/Widget.AppCompat.Light.ActionBar.Solid">
        <item name="android:logo">@drawable/teste_icon_large</item>
        <item name="android:displayOptions">useLogo|showHome|homeAsUp</item>
        <item name="android:background">@drawable/ab_background_login</item>
        <!--Support older APIs-->
        <item name="background">@drawable/ab_background_login</item>
        <item name="logo">@drawable/teste_icon_large</item>
        <item name="displayOptions">useLogo|showHome|homeAsUp</item>
    </style>