androidandroid-attributes

Custom attrs and inheritance


I have a parent style

<style name="AppTheme">
    <item name="ColorPrimary">#000000</item>
    <item name="ColorPrimaryDark">#000000</item>
    <item name="fabEnabled">false</item>
</style>

<style name="AppTheme.MyFragment" parent="AppTheme">
    <item name="colorPrimary">#FFFFFF</item>
    <item name="fabEnabled">true<item>
</style>

<attr name="fabEnabled" format="boolean"/> 

And when I get my attributes in an Activity, with obtainstyledattributes(attrs, R.style.AppTheme_MyFragment)

colorPrimary is #FFFFFF But fabEnabled is false

Did I missed something ?

Thank you


Solution

  • I finally had to wrap the attributes with a use-stylable