When I open the application, I set the theme according to the theme of the device. In android code it is = mode_night_follow_system
.
Let's imagine that the theme of the system(device) is dark. When logging into the mobile app, I do
AppCompatDelegate.setDefaultNightMode(mode_night_follow_system)
The application changes the color to dark, but it feels like it does not take my colors indicated in color-dark.
The problem is only for Xiaomi
phones with Android 10
On other models Samsung
, Huawei
, etc., there are no problems.
What is the problem?
CodePudding user response:
I had the same issue this solved my problem Speciall the second option.
1)Add this line in each activity just below onCreate
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
OR
- add this line in your themes under style section
<item name="android:forceDarkAllowed" tools:targetApi="q">false</item>