Reputation: 24308
I am a little confused about how I should be writing my styles.
I have written some styles and they appear to work great but I am unsure if I should be inheriting from a style.
For example, by default, a text view (for example) has a default style before applying mine?
So I should be inheriting from something else in my style before applying it, i.e. a halo style?
So, for example, I designed the following style
<style name="TestMe">
<item name="android:textSize">30sp</item>
<item name="android:textColor">#FFFF0000</item>
</style>
Which I have applied to a few text views, seems to work great but should I be doing
<style name="TestMe" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:textSize">30sp</item>
<item name="android:textColor">#FFFF0000</item>
</style>
Inheriting from a parent, if so which one?
If I apply a style to my text view and do not inherit, in effect is the text view losing a lot of styles that were predefined on it before applying my style? I know that I have an app theme that inherits from a parent and this is applied in the androidmanifest.xml. So adding a style doesn't override the theme, which in essence is a style?
Or is inheritance on styles only being used when I want to override something?
Upvotes: 1
Views: 1486
Reputation: 1968
Be aware of the precedence order of different styling techniques — if you’re trying to style some text and not seeing the results you expect then your changes are likely being overridden by something higher up in this hierarchy:
Here the whole detail regarding text appearance URL
Upvotes: 1