Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/191.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 更改自定义对话框标题的字体_Android_Android Layout_Android Dialog_Android Fonts_Android Typeface - Fatal编程技术网

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

Android 更改自定义对话框标题的字体,android,android-layout,android-dialog,android-fonts,android-typeface,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(Ty

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

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

我可以很容易地改变对话框中文本的字体。但是如何更改对话框标题的字体呢

如果您希望覆盖整个应用程序中的字体,则可以遵循以下步骤

按照您的方法,您可以使用
R.id.alertTitle
查找alter对话框标题id。然后您可以使用id将字体设置为文本视图