Android - Having different ripple colors for action bar and action mode with AppCompat
Asked Answered
C

0

3

I wonder if it is possibile to have two different colors for the ripple effect in Action Bar and Action Mode. I've tried a lot of solutions but none worked. I've got this in my style.xml file:

<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 action_mode_style.xml file (v21 version):

<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 can't override the colorControlHighlight attribute for the action mode. So now I've the normal action bar with a blue ripple effect and the action mode bar with a dark green background (correct) but a blue ripple effect instead of a green one because of the colorControlHighlight attribute (in fact, if I comment that attribute, I don't have anymore the blue ripple on the action bar and the green one on the action mode). Is there any chance to having two different ripple effects color for action bar and action mode? Thank you all in advice.

Chrysler answered 23/4, 2015 at 10:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.