Android - Having different ripple colors for action bar and action mode using AppCompat

I wonder if it is possible to have two different colors for the ripple effect in the action bar and in the action mode. I tried many solutions but none worked. I have this in the file style.xml


<style name="AppTheme" parent="Theme.AppCompat">
    <item name="colorAccent">@color/holo_blue</item>
    <item name="colorControlHighlight">@color/holo_blue</item>
    <item name="actionModeStyle">@style/ActionModeStyle</item>

<style name="ActionModeStyle" parent="Widget.AppCompat.ActionMode">
    <item name="background">@drawable/action_mode_style</item>


And this is the content of the file action_mode_style.xml

(version v21):

<ripple xmlns:android=""

    <item android:drawable="@color/holo_green_dark" />


My problem is that I cannot override the attribute colorControlHighlight

for the action mode. So now I have a normal action bar with a blue ripple effect and an action mode bar with a dark green background (correct), but the blue ripple effect instead of green due to the attribute colorControlHighlight

(in fact, if I comment out this attribute, I no longer have blue ripple in the action bar and green in action mode). Is it possible to have two different ripple colors for the action bar and action mode? Thank you all for the advice.


source to share

1 answer

see this answer. / ...

look what you need.



All Articles