Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 579
lokoko Avatar asked Feb 22 '13 08:02

lokoko


People also ask

Which method is used to set the text in a TextView?

Set The Text of The TextView You can set the text to be displayed in the TextView either when declaring it in your layout file, or by using its setText() method. The text is set via the android:text attribute.


1 Answers

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);.

like image 111
Matthew Avatar answered Sep 30 '22 19:09

Matthew