According to the Android API Guide Styles and Themes, a style can inherit from another in two different ways:
It can have a
parentattribute:The
parentattribute in the<style>element lets you specify a style from which your style should inherit attributes. You can use this to inherit attributes from an existing style and define only the attributes that you want to change or add.It can have a dotted name, as long as the style being inherited from is one "you've defined yourself":
If you want to inherit from styles that you've defined yourself, you don't have to use the
parent. Instead, you can use dot notation by prefixing the name of the style you want to inherit to the name of your new style, separated by a period.
What happens if a <style> has both a parent and a dotted name? For example, if I have:
<style name="Foo.Bar.Baz" parent="Pen.Pinapple.Apple.Pen">
Does Foo.Bar.Baz inherit from both Foo.Bar and Pen.Pinapple.Apple.Pen? If an attribute is set in both Foo.Bar and Pen.Pinapple.Apple.Pen, which value will it get in Foo.Bar.Baz? What about other cases, like an attribute being set in Pen.Pineapple but also being set in the parent of Foo.Bar? Exactly what are the cascading rules, and where are they documented?