Material-dialogs: The ability to programatically change action button colors

Created on 4 May 2020  路  4Comments  路  Source: afollestad/material-dialogs

Library Version:
3.3.0

There is no option to change the action button text colors!
In older versions, such as 0.9.6.0, there was
MaterialDialog.Builder(context).positiveColor(Color)
method, which is missing in latest release.
Please look into this.
Thanks.

improvement core

Most helpful comment

Thanks for the info!
However, this will set button color globally, right?
Means I can't customize color for a specific instance of MD, right?
Even if I could, this way of setting colors seems a bit less intuitive than setting color while building the specific MD instance, I think, especially since the functionality was there before.
Hope you understand.

All 4 comments

@arpanbag001 Acccording to this merged Pull requests: #1714

You can assign your custom button text color in this way:

styles.xml

<item name="md_color_button_text">@color/md_color_button_text</item>

colors.xml

<color name="md_color_button_text">your custom color</color>

Thanks for the info!
However, this will set button color globally, right?
Means I can't customize color for a specific instance of MD, right?
Even if I could, this way of setting colors seems a bit less intuitive than setting color while building the specific MD instance, I think, especially since the functionality was there before.
Hope you understand.

@arpanbag001 have you tried this block?

.onShow {
                    it.getActionButton(WhichButton.NEGATIVE).updateTextColor(Color.RED)
                    it.getActionButton(WhichButton.NEGATIVE).textSize = 11F
                }

md_color_button_text not working on Android 10. Any ideas why?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pixelbendr picture pixelbendr  路  5Comments

bernaferrari picture bernaferrari  路  5Comments

palaima picture palaima  路  4Comments

CHOIMINSEOK picture CHOIMINSEOK  路  8Comments

timbremer picture timbremer  路  6Comments