Running on my Samsung Galaxy Note, the below code logs 28.0 for each log statement. Am I doing something wrong?
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());
Use the style
class, not attr
.
label.setTextAppearance(context, android.R.style.TextAppearance_Large);
This same point of confusion was reported here: TextView.setTextAppearance not working.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With