简体   繁体   中英

Android actionbar color doesnt change

I have the following styles.xml :

<resources>
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Main theme colors -->
        <item name="android:colorPrimary">@color/primary</item>
        <item name="android:colorPrimaryDark">@color/primary_dark</item>
        <item name="android:colorAccent">@color/accent</item>
    </style>
</resources>

Where primary is defined as:

 <color name="primary">#9c27b0</color>

However in the preview the actionbar is still black and not deep purple. When i open the theme editor the actionbar is also deep purple. Is this a bug in the preview? Or have i done something wrong? In general how exactly do i use the styles.xml ? Can i also define button's in it?

After editing the color code in the color.xml file, you should rebuild it. Try rewriting the code and then rebuilding. I faced the same problem, that's ho

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM