Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to set the Style Attribute Programmatically in Android?

Tags:

android

I have to set the style for a TextView which is created programmatically.

How do I implement style="@style/test" programmatically?

I have looked at the Android developer style documentation already, but it did not answer my question. Any ideas?

like image 750
Praveen Avatar asked Jul 14 '10 13:07

Praveen


2 Answers

Dynamic style change is not currently supported. You must set the style before the view is create (in xml).

like image 135
Robby Pond Avatar answered Oct 18 '22 14:10

Robby Pond


setTypeface(Typeface.DEFAULT_BOLD, Typeface.BOLD_ITALIC);

It works for me

like image 38
Antroid Avatar answered Oct 18 '22 15:10

Antroid