From what I can gather I should be able to create a new textview that uses a style by using
Textview tv = new TextView(this, null, R.style.score_team);
But this doesn't seem to work. It creates the textview but the style isn't applied to it. I have to manually set the style by using
Using java Syntax Highlighting
- Textview tv = new TextView(this);
- tv.setTextAppearance(this, R.style.score_team);
Parsed in 0.030 seconds, using GeSHi 1.0.8.4
Also
I can't get the style to apply gravity. If I put
Using xml Syntax Highlighting
- <item name="android:gravity">center</item>
Parsed in 0.000 seconds, using GeSHi 1.0.8.4
it doesn't apply the gravity (all the other attributes of the style are applied). I have to set the gravity manually by doing the following.
Using java Syntax Highlighting
- Textview tv = new TextView(this);
- tv.setTextAppearance(this, R.style.score_team);
- tv.setGravity(Gravity.CENTER);
Parsed in 0.030 seconds, using GeSHi 1.0.8.4
Which works.
Any clues as to either problem?

