ActionBar aka Toolbar is black after upgrade to Support Library v21

不羁岁月 提交于 2019-12-13 02:38:07

问题


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:


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.



来源:https://stackoverflow.com/questions/26506751/actionbar-aka-toolbar-is-black-after-upgrade-to-support-library-v21

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!