How To Enable Dark Mode on Xiaomi Devices Running MIUI

  1. Xiaomi may be using a different dark theme than the default one that AppCompat uses. So when you set the mode to mode_night_follow_system, it is picking up Xiaomi’s dark colors rather than yours defined in color-dark.
  2. There could be some conflict between Xiaomi’s theme engine and AppCompat. So AppCompat is not able to correctly pick up your custom defined dark theme colors.

Some things you could try:

  • Explicitly set a dark theme using AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES) and define colors in color-night. See if that helps.
  • Try using a different dark theme like Material Dark theme and see if the issue persists.
  • See if you can disable Xiaomi’s theme engine for your app only. Not sure if that is possible though.
  • File a bug report with Xiaomi describing the issue. They may need to fix something in their theme implementation.

Unfortunately without access to a Xiaomi device to test, it’s hard to pinpoint the exact cause. But hopefully some of the above suggestions help narrow it down or work around it. Let me know if you have any other questions!