ActionBar aka Toolbar is black after upgrade to Su

2019-08-05 07:36发布

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.

1条回答
神经病院院长
2楼-- · 2019-08-05 08:09

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.

查看更多
登录 后发表回答