0

Having this attrs.xml file:

<resources>
    <attr name="customColorPrimary" format="color" value="#111111"/>
</resources>

It is possible to write with java code a new value for that color?

Can't find how to do it in the official documentation...

1 Answer 1

1

Short answer: No.

Long answer: All resources you use in your code are compiled as contents of R class. Every single resource (including string, dimen, layout, style, attr and other) is compiled as some variation of public staticfinalint values. That's why you can't modify it during runtime.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.