下面的代码在我的Samsung Galaxy Note上运行,每条日志语句的日志为28.0。我做错了什么吗?
label = new TextView(context);
Log.e("text size", "" + label.getTextSize());
label.setTextAppearance(context, android.R.attr.textAppearanceLarge);
Log.e("text size", "" + label.getTextSize());
label.setTextAppearance(context, android.R.attr.textAppearanceSmall);
Log.e("text size", "" + label.getTextSize());
发布于 2011-12-23 02:10:29
使用style
类,而不是attr
。
label.setTextAppearance(context, android.R.style.TextAppearance_Large);
这里也报道了同样的困惑:TextView.setTextAppearance not working。
https://stackoverflow.com/questions/8608076
复制相似问题