android - How does inheritance behave when a style has both a parent attribute and a dotted name? -


according android api guide styles , themes, style can inherit in 2 different ways:

  • it can have parent attribute:

    the parent attribute in <style> element lets specify style style should inherit attributes. can use inherit attributes existing style , define attributes want change or add.

  • it can have dotted name, long style being inherited 1 "you've defined yourself":

    if want inherit styles you've defined yourself, don't have use parent. instead, can use dot notation prefixing name of style want inherit name of new style, separated period.

what happens if <style> has both parent , dotted name? example, if have:

 <style name="foo.bar.baz" parent="pen.pinapple.apple.pen"> 

does foo.bar.baz inherit both foo.bar , pen.pinapple.apple.pen? if attribute set in both foo.bar , pen.pinapple.apple.pen, value in foo.bar.baz? other cases, attribute being set in pen.pineapple being set in parent of foo.bar? cascading rules, , documented?

if specify both, parent attribute "wins".

<style name="mystyle1">     <item name="android:textcolor">#00f</item> </style>  <style name="mystyle2">     <item name="android:textsize">18sp</item> </style>  <style name="mystyle2.substyle" parent="mystyle1">     <item name="android:textstyle">bold</item> </style> 

enter image description here


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -