以编程方式使用setTextSize到?attr/textAppearanceLarge

Cal*_*yth 11 android textview

我现在正在修改自定义首选项,我想使用TextView为它添加标签.但是我似乎找不到使用setTextView()将文本大小指定为"大"的方法

我在这里错过了什么?

Sha*_*wal 38

TextView title = new TextView(context);
title.setTextAppearance(context, android.R.attr.textAppearanceLarge);
Run Code Online (Sandbox Code Playgroud)

或尝试

setTextAppearance(context, android.R.style.TextAppearance_Large);
Run Code Online (Sandbox Code Playgroud)

使用上面的代码并尝试

  • 这不起作用,正确的响应是`setTextAppearance(context,android.R.style.TextAppearance_Large);` (12认同)