更改自定义对话框标题的字体

时间:2014-04-07 14:33:15

标签: android android-layout android-dialog android-fonts android-typeface

这是我已实施的自定义对话框的代码

            final Dialog dialog = new Dialog(context);
    dialog.setContentView(R.layout.custom_dialog);
    dialog.setTitle("This is the Title");
    TextView text = (TextView) dialog.findViewById(R.id.text);
    text.setTypeface(Typeface.createFromAsset(getAssets(), 
            "fonts/Barkentina.otf"));

我可以轻松更改对话框中文字的字体。但是我该怎么做才能改变对话框标题的字体呢?

1 个答案:

答案 0 :(得分:1)

如果要覆盖整个应用程序中的字体,可以按照此answer进行操作。

根据您的方法,您可以按照answer使用R.id.alertTitle来查找更改对话框标题ID。然后,您可以使用id。

将字体设置为TextView
相关问题