How can we customize the fonts of android alert dialog using styles
I found many solution using
setTypeFace()
method. But I want to customize the entire application alert dialog using styles.
I would like to change the title, message, buttons fonts.
I was able to change the message font using the following codes.
My style declaration for alert dialog
<style name="MyAlertDialougeTheme" parent="@android:style/Theme.Material.Light.Dialog.Alert">
<item name="android:textAppearanceSmall">@style/MyTextAppearance</item>
<item name="android:textAppearanceLarge">@style/MyTextAppearance</item>
<item name="android:textAppearanceMedium">@style/MyTextAppearance</item>
</style>
Java code to display alert dialog
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this,
R.style.MyAlertDialougeTheme);
builder.setTitle("Warning")
.setMessage("My message here")
.setPositiveButton("yes", null)
.setNegativeButton("no", null)
.show();
Review below screen
Please help me to change the title and buttons fonts using styles and also I would like to customize the font color for the negative & positive buttons.
Advance thanks for your time and help!!