0

I'm trying to implement Button (AppCompatButton) with ripple effect and selector (focused, hovered, disabled etc.). I've created drawable.xml which looks like this:

<ripple android:color="#rippleColor">
    <item><shape android:shape="rectangle">...</shape>
    <item>
        <selector>
            <item android:state_enabled="false">
                <shape>...</shape>
            </item>
            <item android:state_focused="true">
                <shape>...</shape>
            </item>
            ...another states...
        </selector>
    <item>
</ripple>

This code works, but if use d-pad or cursor navigation, when Button is focused or hovered, instead of colors from selector, ripple color is being used.

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
Alex.Marynovskyi
  • 1,264
  • 3
  • 16
  • 22
  • Did you try a `MaterialButton`? Just use the `rippleColor` and `backgroundTint`(selector) attributes. – Gabriele Mariotti Jun 02 '20 at 10:37
  • @GabrieleMariotti just tried it. I've used MaterialButton and added only one color for backgroundTint (no selector) and ripple color and the result is the same - when the button became focused/hovered it uses ripple color to highlight button – Alex.Marynovskyi Jun 02 '20 at 15:23

0 Answers0