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>

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

      

And this is the content of the file action_mode_style.xml

(version v21):

<ripple xmlns:android="http://schemas.android.com/apk/res/android"
    android:color="@color/holo_green">

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

      

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.

+3


source to share


1 answer


see this answer. fooobar.com/questions/6472604 / ...



look what you need.

0


source







All Articles