【问题标题】:Change the font of Custom dialog box title更改自定义对话框标题的字体
【发布时间】:2014-04-07 14:33:15
【问题描述】:

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

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

我可以轻松更改对话框内文本的字体。但是我能做些什么来改变对话框标题的字体呢?

【问题讨论】:

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


    【解决方案1】:

    如果您想覆盖整个应用程序中的字体,则可以关注此answer。

    根据您的方法,您可以按照此answer 使用R.id.alertTitle 查找更改对话框标题ID。然后你可以将字体设置为带有 id 的 TextView。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-05-30
      • 1970-01-01
      • 1970-01-01
      • 2015-05-21
      • 1970-01-01
      • 1970-01-01
      • 2019-03-12
      相关资源
      最近更新 更多