简体   繁体   中英

Android. Xiaomi (android 10+) mode_night_follow_system wrong color when phone system theme is dark

the problem is:

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?

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM