RippleColor is not working for MaterialAlertDialog
I had setup a theme as:
<style name="Material.Dialog.Alert" parent="ThemeOverlay.MaterialComponents.MaterialAlertDialog">
<item name="buttonBarPositiveButtonStyle">
@style/Material.Dialog.Alert.Button.Positive
</item>
</style>
for the MaterialAlertDialog:
<item name="materialAlertDialogTheme">@style/Material.Dialog.Alert</item>
and a TextButton styles as:
<style name="Material.Dialog.Alert.Button.Positive" parent="Widget.MaterialComponents.Button.TextButton">
<item name="rippleColor">@color/link_primary</item> //This property doesnt have any effect
<item name="android:textColor">@color/link_primary</item>
</style>
Parent theme: Theme.MaterialComponents.Light.NoActionBar.Bridge
Android API version: 21, 25, 28, 29
Material Library version: com.google.android.material:material:1.1.0-alpha04 (Didnt see any fix on the new releases documentation though)
What does @color/link_primary look like?
Does it use a similar structure as our default text button ripple color?
Does setting rippleColor to your @color/link_primary on a text button outside of a MaterialAlertDialog work?
Can you try with the latest version of the Material library just to make sure the issue hasn't been fixed?
Removing rippleColor at all, it doesnt work either. Shouldnt it fallback to the mtrl_btn_text_btn_ripple_color.xml selector you referenced?
It tried both with a similar structure (selector) and a _color resource_ and it doesnt work
Using rippleColor on a text button outside MaterialAlertDialog works with @color/link_primary
This is not working with the latest version (1.2.0-alpha03) too if the parent theme is Theme.MaterialComponents.Light.NoActionBar.Bridge
It works, if parent theme is Theme.MaterialComponents.Light.NoActionBar though
_I mean the ripple effect for MaterialAlertDialog is not working at all (even the default one - mtrl_btn_text_btn_ripple_color.xml) when the parent theme is set to Theme.MaterialComponents.Light.NoActionBar.Bridge_
Any news?
Tested with 1.2.0-beta01 bug still exists
On 1.1.0 everything is working fine
Removing
rippleColorat all, it doesnt work either. Shouldnt it fallback to themtrl_btn_text_btn_ripple_color.xmlselector you referenced?It tried both with a similar structure (
selector) and a _color resource_ and it doesnt workUsing
rippleColoron a text button outsideMaterialAlertDialogworks with@color/link_primary
I am not sure it is a bug.
You are using a Bridge theme. It means that the buttons inside the AlertDialog are AppCompatButton instead of MaterialButton.

The rippleColorattribute is known at AppCompatButton and it is not used at all.
If you want to change the rippleColor you can use something like:
<style name="Material.Dialog.Alert" parent="ThemeOverlay.MaterialComponents.Dialog.Alert">
<item name="buttonBarPositiveButtonStyle">@style/Widget.AppCompat.Button.Borderless</item>
<item name="buttonBarNegativeButtonStyle">@style/Widget.AppCompat.Button.Borderless</item>
<item name="colorControlHighlight">@color/....</item>
</style>
Most helpful comment
This is not working with the latest version (
1.2.0-alpha03) too if the parent theme isTheme.MaterialComponents.Light.NoActionBar.BridgeIt works, if parent theme is
Theme.MaterialComponents.Light.NoActionBarthough_I mean the ripple effect for
MaterialAlertDialogis not working at all (even the default one -mtrl_btn_text_btn_ripple_color.xml) when the parent theme is set toTheme.MaterialComponents.Light.NoActionBar.Bridge_