Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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:

enter image description here

But when i switch to night mode, colors are the following:

enter image description here

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
736 views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...