İçeriğe geç

How to prevent force dark mode in Android?

Kategori: Android

We will consider how to prevent the feature of forcing the applications to dark mode, which usually appears on Xiaomi devices.

First of all, we should open \android\app\src\main\res\values path of our project. The code we will add to the styles.xml file in this directory will prevent the dark mode. So, we can open styles.xml file and add <item name="android:forceDarkAllowed">false</item> tag into <style></style> tag.

dark mode preventation
This is the final form of styles.xml for preventing dark mode

When we build the application again, devices won’t be able to force the application to dark mode anymore.




Yazının Türkçe versiyonu için tıklayın.

İlk Yorumu Siz Yapın

Bir cevap yazın

E-posta hesabınız yayımlanmayacak.