3
votes

when entering actionmode in AppCompat 21 my ActionBar gets grey - the colors are not used:

<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/secondary</item>
<item name="color">@color/secondary</item>

I think I am just missing the right name for setting this color - but there is nothing with action as far as I see.

2

2 Answers

9
votes

ActionMode does not take the colors you defined in primaryColor (at least for now). To set the color of the ActionMode, you just need to define it by your own, like:

<item name="actionModeBackground">@color/primary</item>

Or in a more generic way, which is better if you support different color themes in one app:

<item name="actionModeBackground">?attr/colorPrimary</item>
0
votes

Actionbar is deprecated in API 21.You need to use Toolbar instead.

if you still want to get a styles.xml, here is a sample styles.xml with correct name

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat">
    <!-- Customize your theme here. -->
    <item name="windowActionBar">false</item>
    <item name="android:windowNoTitle">true</item>

    <!-- Actionbar color -->
    <item name="colorPrimary">@color/accent_material_dark</item>
    <!--Status bar color-->
    <item name="colorPrimaryDark">@color/accent_material_light</item>
    <!--Window color-->
    <item name="android:windowBackground">@color/dim_foreground_material_dark</item>
</style>