Closed vbiswal closed 4 years ago
Hi, thanks for using this library!!
If you need change button colors and general text, you should use your project theme and customize.
Create custom styles to AlertDialog Buttons
<style name="PositiveButtonStyle" parent="Widget.AppCompat.Button.ButtonBar.AlertDialog">
<item name="android:textColor">#FF4081</item>
<item name="android:background">#26FF4081</item> <!--If you need change button background color-->
</style>
<style name="NegativeButtonStyle" parent="Widget.AppCompat.Button.ButtonBar.AlertDialog">
<item name="android:textColor">#2A2929</item>
</style>
Create AlertDialog custom styles
<style name="AlertDialogCustom" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="android:textColor">#FF4081</item> <!--Title text color-->
<item name="android:textColorPrimary">#C92525</item> <!--Item text color-->
<item name="android:textColorSecondary">#A11846</item> <!--If you need change separator color-->
<item name="android:buttonBarNegativeButtonStyle">@style/NegativeButtonStyle</item>
<item name="android:buttonBarPositiveButtonStyle">@style/PositiveButtonStyle</item>
</style>
In your root theme add:
<item name="android:alertDialogTheme">@style/AlertDialogCustom</item>
The result should be:
Thank you for your help!!! It worked...
Thank you for your help!!! It worked...
Many thanks. Please help me, change text of Button confirm Dialog.
Thank you for your help!!! It worked...
Many thanks. Please help me, change text of Button confirm Dialog.
Hi! Currently the values android.R.string.ok and android.R.string.cancel are used. I will soon add custom text for the buttons.
this method does not work for me when using the app theme 'Theme.MaterialComponents.Light'
Edit:
My bad, it actually works, I was just setting a different style
How to change textcolor for the Dialog- for cancel and ok buttons? I tried out with set style but was unable. Please suggest a sample code to change the color. Thanks in advance...