Search code examples
androidandroid-actionbarandroid-5.0-lollipopandroid-actionbar-compatandroid-toolbar

ActionBar aka Toolbar is black after upgrade to Support Library v21


I have just upgraded to the newest library version after Android Lollipop was released. After I fixed serveral doublicated attributes (which where caused by the Support Library) I updated my android-switch-backport, and it compiled again.

However now I have no more the ActionBar, it is now a Toolbar. So far so good, but now is that Toolbar black and I have no idea why.

So how can I change it back to my custom colors, I used Android Action Bar Style Generator, for generating all required resources.


Solution

  • After a quiet long search I found in the documentation, that I need to defind the colors in the theme.

    <style name="Theme.MyTheme" parent="Theme.AppCompat.Light">
        <!-- customize the color palette -->
        <item name="colorPrimary">@color/primary_color</item>
        <item name="colorPrimaryDark">@color/secondary_color</item>
        <item name="colorAccent">@color/accent_color</item>
    </style>
    

    Now I can remove the images generated by the Android Action Bar Style Generator, since I don't need them anymore.