i have implemented dark ui in my android app everything is working fine but i have a launcher activity which has windowBackground
in styles like this
<style name="AppTheme.Launcher" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="android:windowBackground">@drawable/l_launch_screen</item>
</style>
and the l_launch_screen
is this
<?xml version="1.0" encoding="utf-8"?>
<!-- The android:opacity=”opaque” line — this is critical in preventing a flash of black as your theme transitions. -->
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android"
android:opacity="opaque">
<!-- The background color, preferably the same as your normal theme -->
<item android:drawable="@color/colorPrimaryDark"/>
<!-- Your product logo - 144dp color version of your app icon -->
<item>
<bitmap
android:src="@drawable/app_round_icon"
android:gravity="center"/>
</item>
</layer-list>
and in this colorPrimaryDark
has two color one is night and other is simple
now the issue is that when the dark theme is activated by android by selecting Dark theme
in android q notification panel android:windowBackground
is picking night color but when Dark theme
is disabled by android and dark theme is selected in my app by setting this in application class
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
android:windowBackground
is not picking the night color but all other activities is picking the night color perfectly I have seen the same behavior with WhatsApp
app so is this a bug or i am doing something wrong I have also tried define different styles for the night and for drawable but happening the same issue
This is how to implement loading screen using Activities approach.
<color name="black_700">#191414</color>
) :AndroidManifest.xml
: