【发布时间】:2015-12-01 09:44:25
【问题描述】:
我正在尝试更改android.support.v7.app.AlertDialogtitle 文本的字体。
方法一:
TextView title = (TextView) dialog.findViewById(android.R.id.title); //returns null
方法 2:
final int titleId = context.getResources().getIdentifier("alertTitle", "id", "android");
TextView title = (TextView) dialog.findViewById(titleId); //Also returns null.
有没有其他方法可以得到标题TextView?
请注意,我不想使用自定义布局。
谢谢。
【问题讨论】:
-
我认为您的上下文为空。核实!发布 AlertDialog 的完整代码。
标签: android android-alertdialog