Library Version:
2.7.0
Affected Device(s):
Google Pixel with Android 9.0
Describe the Bug:
Button colour is not changed.
To Reproduce:
MaterialDialog(context).title(R.string.ok)
.positiveButton(R.string.ok) { whatever() }
.apply {
getActionButton(WhichButton.POSITIVE).updateTextColor(Color.BLUE)
}
.show()
Button colour is still black
Expected Behavior:
Button colour should be blue
+1 #1782
@mac229 action button colors should be changed from your theme, not programatically.
https://github.com/afollestad/material-dialogs/blob/master/documentation/CORE.md#text-color
And the default value is whatever colorPrimary is in your theme.
I want to change the color of the button with code, like before, positiveColor (xxxx). What should I do?
i use this code for button color change
getActionButton(WhichButton.NEGATIVE).updateTextColor(Color.BLACK)
but that is not effect
In some cases there can be multiple dialogs in the same activity with different colored buttons because that's what the designers want. Would be nice to have this API working as expected
Any updates on this, upgraded recently from 0.9.6.0 and refactored all of my code in over 48 different places to see that there was no way to set individual action button colors/ripple/them. I very much appreciate going for the full bore Material spec, but wouldn't it make sense to be able to set a complete theme for dialogs based on ThemeOverlay.MaterialComponents/AppCompat.Dialog?
I also just finished an arduous migration and wasn't expecting this regression. My design requires some buttons to be a different color than the theme color.
@mac229 action button colors should be changed from your theme, not programatically.
https://github.com/afollestad/material-dialogs/blob/master/documentation/CORE.md#text-color
Sometimes I need to have a few different colors, but these apis don't work, so I rewrote one myself in response to these requirements.馃槀
In some cases there can be multiple dialogs in the same activity with different colored buttons because that's what the designers want. Would be nice to have this API working as expected
No need to go super far away with examples. Take a destructive action for example, such as "Delete".
Everyone who want to change button color programmatically you can use this :
onShow{
it?.getActionButton(WhichButton.NEGATIVE).updateTextColor(Color.GRAY)
}
Most helpful comment
Everyone who want to change button color programmatically you can use this :
onShow{ it?.getActionButton(WhichButton.NEGATIVE).updateTextColor(Color.GRAY) }