android-night-mode

Night Mode color is not applying to the recycler view background

强颜欢笑 提交于 2021-01-27 21:03:08
问题 I want to implement night mode for my android app so I have used Theme.AppCompat.DayNight theme for implementing Night Mode. But I have to customize the color of the Toolbar and recycler view during the Night Mode. For that, I have declared the attribute in the attrs.xml file and use that attribute as a background in the recyclerview. Here is the attrs.xml file <?xml version="1.0" encoding="utf-8"?> <resources> <declare-styleable name="ds"> <attr name="rv_color" format="color"/> </declare

Letting WebView on Android work with prefers-color-scheme: dark

穿精又带淫゛_ 提交于 2020-07-28 12:40:45
问题 I have an Android App that uses webview, and lately I'm trying to figure out how to add a dark theme by using the new @media (prefers-color-scheme: dark) CSS syntax. I have the correct CSS written on my page, and if I open it in Chrome with the dark mode of Chrome turning on, it works. I also have my AppTheme inheriting Theme.AppCompat.DayNight , and my app shows dark loading dialog etc. when I turn on dark mode for the entire OS on my device. Even the auto-complete options for the <input>

ContextCompat.getColor method ignores Night Mode

主宰稳场 提交于 2019-12-12 15:03:27
问题 I am working on Night mode for my Android app. I'm using ContextCompat.getColor to get colours programmatically for some UI elements, however this method it's not fetching the correct colour. When the app is in Night mode, so adhering to the night resource qualifier, ContextCompat fetches the color from values/colors.xml and not values-night/colors.xml. Curiosly, if I call ContextCompat.getColor from an Activity, it returns me the correct color //get Actual Theme Colors String bgColor =

Android can't inflate layout file with attrs values

雨燕双飞 提交于 2019-12-04 05:01:28
问题 I am working on an app that can switch between night mode and day mode i made an attrs file with the values <?xml version="1.0" encoding="utf-8"?> <resources> <declare-styleable name="ds" > <attr name="backgroundcolor" format="color"/> <attr name="cardbackground" format="color"/> <attr name="textcolor" format="color"/> <attr name="tintcolor" format="color"/> <attr name="buttoncolor" format="color"/> </declare-styleable> </resources> and i made corresponding two styles that are for day mode

Android - How to detect if night mode is on when using AppCompatDelegate.MODE_NIGHT_AUTO

守給你的承諾、 提交于 2019-11-28 23:17:50
I'm using Androids built in day/night mode functionality and I'd like to add an option to my app for AppCompatDelegate.MODE_NIGHT_AUTO I'm having a problem though because my app requires certain things to be colored programmatically, and I can't figure out how to check if the app considers itself in night or day mode. Without that, I can't set a flag to choose the right colors. Calling AppCompatDelegate.getDefaultNightMode() just returns AppCompatDelegate.MODE_NIGHT_AUTO which is useless. I don't see anything else that would tell me, but there must be something? ephemient int nightModeFlags =

Android - How to detect if night mode is on when using AppCompatDelegate.MODE_NIGHT_AUTO

不羁岁月 提交于 2019-11-27 20:57:39
问题 I'm using Androids built in day/night mode functionality and I'd like to add an option to my app for AppCompatDelegate.MODE_NIGHT_AUTO I'm having a problem though because my app requires certain things to be colored programmatically, and I can't figure out how to check if the app considers itself in night or day mode. Without that, I can't set a flag to choose the right colors. Calling AppCompatDelegate.getDefaultNightMode() just returns AppCompatDelegate.MODE_NIGHT_AUTO which is useless. I