Android RRO - overlay custom attribute

Viewed 84

In my main Android application, I have defined an attribute and it points to some color. It looks something like this:

<declare-styleable name="ThemeColors">
    <attr name="my_button_background" format="color" />
</declare-styleable>

And then I have my syle

<style name="MyTheme">
    <item name="my_button_background">@color/color_blue</item>
</style>

After that, i setup my button like this:

<Button
    style="@style/some_style"
    android:text="@string/some_text"
    android:background="?attr/my_button_background"/>

Now, in my overlay app, if I do something like this, and it works perfectly

<color name="color_blue">#FFFF00</color>

But, if I want to override attribute using this, it does not work.

<color name="my_button_background">#FFFF00</color>

Alternate solution is to wrap color_blue with something like color_button_background, then use that as a pointer for my attribute, and override that in my RRO. But it just brings up a lot of clutter. And I have tons of attributes, which will make this job much more time consuming.

Can someone please help me with this one? Is there a way to overlay attributes? I tried Googling this one out, but I found no solution.

0 Answers
Related