Search code examples
androidstylestextviewandroid-styles

How do I set the style of a textView programmatically?


I'm creating a textView programmatically. Is there a way that i can set the style of this textView? Something similar to

style="@android:style/TextAppearance.DeviceDefault.Small"

which I would use if I had a layout.xml file.


Solution

  • You can't programmatically set the style of a View, but you might be able to do something like textView.setTextAppearance(context, android.R.style.TextAppearance_Small);.