Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change title font of Alert Dialog box

Tags:

I want to change the font of the title of Alert Dialog box.

Can anybody tell how can I do it?

like image 530
Eagle_Eye Avatar asked Jun 04 '13 09:06

Eagle_Eye


People also ask

How do I change the font in alert box?

If you only want to change text format, you can just override alertDialogTheme attribute to change the theme for the AlertDialog .

How do you change the font of a title?

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.

Which method is used to set a title to a alert dialog?

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.

What is the difference between dialog and AlertDialog?

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 .


1 Answers

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..

like image 120
Eagle_Eye Avatar answered Oct 23 '22 16:10

Eagle_Eye