I am new to android and I am trying to disable system's dark mode affect on my app but cant achieve that anyway.Here's my theme.xml and its same in theme-night
<style name="Theme.MyAppName" parent="Theme.MaterialComponents.Light.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/dark_red</item>
<item name="colorPrimaryVariant">@color/dark_red</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
<item name="android:forceDarkAllowed" tools:targetApi="q">false</item>
</style>
I tried deleting the theme-night file. I have also tried this line juts below the onCreate AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); I also tried putting android:forceDarkAllowed=false in the layout of MainActivity. None of the solution worked for me.
I am testing the app in Realme 2 Android 9. Please someone help me to achieve this.