Forum Xamarin.Android


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Problem with colors and themes on MIU12 Xiaomi phones


I'm having a problem with invoking the Light theme in my app. Whatever I tried to do it wasn't working. The phone I'm testing on is Xiaomi Redmi Note 7 and Xiaomi Redmi Note 8.

So basically what I'm trying to do is to force my application to use Light Mode, because in MIU when the system Dark Mode is on, I'm getting all the wrong colors. When I turn off the Dark mode, everything is working fine.

We have tried many examples, such as using different light themes style (AppCompat, Material, etc.) but nothing changes.

Even in the Xamarin theming demo, which demonstrates the appliance of themes, when I choose the light mode, nothing changes.

Is there any way we can force switch off the Dark Mode for application, or use LightMode theme despite devices is using system DarkMode?


  • jezhjezh Member, Xamarin Team Xamurai

    Besides MIU12 Xiaomi phone, can this problem be reproduced on other devices?

  • vojvodavojvoda Member ✭✭
    I tested in on Samsung Galaxy S8, S9, S10, Motorola Moto G. It worked without a problem, even though using the system Dark mode.
  • vojvodavojvoda Member ✭✭

    One more thing that I noticed is that on the dark mode options there are settings where you can turn off dark mode for each application individually. Currently, on my phone, I got installed all the regular apps, none of which are using DarkMode by default. The one that I made using Xamarin uses it. Is there any way I can invoke this parameter to be disabled on the installation of the app?

  • vojvodavojvoda Member ✭✭


    Any updates on this? Does anybody have the same problem?

    Also, I updated to Xamarin.Forms 5, still I have the same problem

  • RafaVerneRafaVerne Member

    Hi, i have the same problem. Did you find a solution?

  • nathanmarknathanmark Member

    I am having this problem while using itunes. Anyone found any solution?

  • ChrStephanChrStephan Member

    The answer from works for us:

    "The working solution was to add <item name="android:forceDarkAllowed">false</item> inside our main AppTheme block in styles.xml"

    Probably you can add this workaround only for Xiaomi phones by detecting the manufacturer with Xamarin.Essentails and using setForceDarkAllowed(false).

Sign In or Register to comment.