Can the user change colors of the compiled application?

0

I'm thinking of creating an app where the user can change their Layout colors as they want with pre-defined colors, but I can not think of a way to do that, if at all possible. Does anyone know something similar?

    
asked by anonymous 27.09.2017 / 00:42

1 answer

1

I found an easy way.

I created a file res / values / attrs.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <attr name="drawable_color" format="reference" />
    <attr name="background_color" format="reference"/>
    <attr name="font_color_1" format="reference" />
    <attr name="font_color_2" format="reference" />
</resources>

And in the file res / values / styles.xml I added the following code:

<style name="RedTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorDkRed2</item>
    <item name="colorPrimaryDark">@color/colorDkRed1</item>
    <item name="colorAccent">@color/colorBlack1</item>
    <item name="drawable_color">@color/colorDkRed2</item>
</style>

Where I can set the color you want for this attribute that will be applied to the drawable item.

    
27.09.2017 / 02:47