android ProgressDialog fontSize change

2019-03-31 01:17发布

问题:

Is it possible to change the font size and make text bold which is displayed in a ProgressDialog .I have created a ProgressDialog like this:

private ProgressDialog dialog;
this.dialog = ProgressDialog.show(Activity.this, "Heading","Message...", true);

I want to make Heading bold and increase the font size..pls help

回答1:

If you import android.text.Html; then you will be able to use the Html.fromHtml() method to do it, like so:

private ProgressDialog dialog;
this.dialog = ProgressDialog.show(Activity.this, Html.fromHtml(
               "<b>Heading<b>"), Html.fromHtml("<big>Message...</big>"), true);

You should also be able to use other Html text formatting tags like <small> <u> <i> <sub> etc., and obviously you can mix and match them like any other html text.