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将字体设置为文本视图