I'm developing an android app and i need to allow user to choose via color picker the list view items's background color. Each listview item is a LinearLayout and i set the background color inside my adapter in this way:
holder.rowLayout.setBackgroundColor(this.backgroundColor!!)
All works perfectly in day mode but when the app switches to night mode i'm experiencing problems with colors.
Let's take this example: in day mode i choose bright green background and it correctly applies to the list:
But when i switch to night mode, colors are the following:
Now, i don't want to disable day ight to all the application. I've all my themes responsive to day ight preference, i just want to avoid dark mode to alter colors of this listview only since it's the user that choose its background color and i don't want Android to alter it.
I've tried to apply older themes to the linear layout and using LinearLayoutCompat without luck. Is there somebody that can help me?
question from:https://stackoverflow.com/questions/65946221/android-view-setbackgroundcolor-and-night-mode