styles multiple inheritance

NPike picture NPike · Jul 15, 2010 · Viewed 16.8k times · Source

Is there any way to make a style inherit from multiple other styles, instead of just being limited to:

<style name="WidgetTextBase">
    <item name="android:typeface">serif</item>
    <item name="android:textSize">12dip</item>
    <item name="android:gravity">center</item>
</style>

<style name="BOSText" parent="WidgetTextBase">
    <item name="android:textColor">#051C43</item>
</style>

I would like BOSText to also inherit from:

<style name="WidgetTextHeader">
    <item name="android:textStyle">bold</item>
<style>

Answer

Jonas picture Jonas · Jul 22, 2011

No, styles do not support multiple inheritance (at least not as of Android 3.2).

The official docs explain it clearly:

If you use the dot notation to extend a style, and you also include the parent attribute, then the parent styles override any styles inheritted through the dot notation.