安卓ProgressDialog fontSize的变化ProgressDialog、fontSize

2023-09-05 08:21:06 作者:黑名单有你更精彩°

是否有可能改变字体大小,使文本加粗并显示在一个 ProgressDialog 。我已经创建了一个 ProgressDialog 是这样的:

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);

我想打的标题粗体和增加字体size..pls帮助

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

推荐答案

如果您进口android.text.Html; ,那么你就可以使用 Html.fromHtml()的方法来做到这一点,就像这样:

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);

您也应该能够使用其他HTML文本格式的标签,如&LT;小&GT; &LT; U&GT; &LT; I&GT; &lt;副&GT; 等,很明显,你可以混合和匹配他们像任何其他HTML文本

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.