I want to change the font of the title of Alert Dialog box.
Can anybody tell how can I do it?
If you only want to change text format, you can just override alertDialogTheme attribute to change the theme for the AlertDialog .
Click on My Sites, then click the Customize button next to Themes. Click on Fonts. Select a different font under Headings. That will change the font for the site title and all other headings on the site.
Alert Dialog code has three methods: setTitle() method for displaying the Alert Dialog box Title. setMessage() method for displaying the message. setIcon() method is use to set the icon on Alert dialog box.
AlertDialog is a lightweight version of a Dialog. This is supposed to deal with INFORMATIVE matters only, That's the reason why complex interactions with the user are limited. Dialog on the other hand is able to do even more complex things .
I found a simple solution..
At first I was setting the title of my alert box by
builder.setTitle("My Title");
So I was not able to change the font of it..
Then what worked for me is..
I created a simple TextView :
TextView tv2;
And set all properties of TextView which I wanted...
And then I replaced my
builder.setTitle("My Title");
line with
builder.setCustomTitle(tv2);
and now I can change Title Color
, Font
Etc By Changing tv2's
Properties..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With