gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 02:58:34 25 4
gpt4 key购买 nike

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

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

我可以很容易地更改对话框中文本的字体。但是我能做些什么来改变对话框标题的字体呢?

最佳答案

如果您想覆盖整个应用程序中的字体,那么您可以按照此 answer 进行操作.

根据您的方法,您可以遵循此 answer它使用 R.id.alertTitle 来查找更改对话框标题 ID。然后,您可以使用 id 为 TextView 设置字体。

关于android - 更改自定义对话框标题的字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22915418/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com