Set style for TextView programmatically

I’m trying to use the TextView constructor with style like this:

TextView myText = new TextView(MyActivity.this, null, R.style.my_style);

However, when I do this, the text view does not appear to take the style (I verified the style by setting it on a static object).

I’ve also tried using myText.setTextAppearance(MyActivity.this, R.style.my_style) but it also doesn’t work.

12 Answers
12

Leave a Comment