Home > Back-end >  Android Xiaomi (Android 10 ) mode_night_follow_system wrong color when phone system theme is dark
Android Xiaomi (Android 10 ) mode_night_follow_system wrong color when phone system theme is dark

Time:05-28

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

  1. add this line in your themes under style section
<item name="android:forceDarkAllowed" tools:targetApi="q">false</item>
  • Related