Home > Software design >  Force disable dark mode in android application not working
Force disable dark mode in android application not working

Time:02-14

I have force disable dark mode in my android application but still the app is in dark mode when my phone is in dark mode

I have also changed the theme for both light and night modes to light theme with no action bar but its not working

CodePudding user response:

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