1

I have colors of text and button come dynamic form backend, I need to change this color of text dynamically when change happens in backend all at time.

I could make it manual

textView.setTextColor(getResources().getColor(R.color.text_color));

Is there a way to change group of text color dynamically or must set every text color manually in code?

I searched for how to change theme colors dynamically at run time and i found this answer this answer.

But I also search again and I found this github
but it doesn't work on Android Marshmallow (6.0+) and it's use is discouraged! as he say.

Is there any lib or method to change the theme on runtime?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Hossam elsawy
  • 86
  • 1
  • 6
  • 3
    You need to provide some information about what your issue is and how you have tried to resolve it, or what research you have done already. – Phil Nov 08 '17 at 10:31
  • https://stackoverflow.com/questions/25815769/how-to-really-programmatically-change-primary-and-accent-color-in-android-loll check this link ,please my problem like this case, but for group of text – Hossam elsawy Nov 08 '17 at 11:21
  • Do you have any code to show the text and buttons you are trying to change? If so, please edit the question and put it in there. Also, is there anything in the link you provided in your comment that makes you think this should be different? If so, perhaps you could explain why you have looked at that question and you think there is a reason your question should get a different response. Overall, please put more detail into your question to help people understand what you need. – Phil Nov 08 '17 at 14:41

1 Answers1

1

So far it's impossible and not viable because of themes are immutable.

GreenMatter becomes outdated so regretfully the answer of your question is No way.

More precisely, the color overriding at runtime is not working. There is no fix found at the moment. The future of this feature is uncertain.

HMagdy
  • 3,029
  • 33
  • 54