Is there a way to set the textStyle attribute of a TextView programmatically? There doesn\'t appear to be a setTextStyle() method.
Since setTextAppearance(resId) is only available for API 23 and above, use:
TextViewCompat.setTextAppearance(textViewGoesHere, resId)
This method is internally implemented as follows:
public static void setTextAppearance(@NonNull TextView textView, @StyleRes int resId) {
if (Build.VERSION.SDK_INT >= 23) {
textView.setTextAppearance(resId);
} else {
textView.setTextAppearance(textView.getContext(), resId);
}
}