Changing the style after creating the view is not supported .. so what you can do is:
- create a new android xml file of type values
- add new theme
- add your elements to that theme and their values and save the file
Now, when you are dynamically creating the new view you call the constructor that will allow to define a defStyle. Then, you point to the style ID you have just created by pointing to R."the XML file name"."your style ID"
myTextView.setTextAppearance(getApplicationContext(), R.style.boldText);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…