I am trying to implement a splash screen.
I have followed the splash screen API approach implemented the
implementation 'androidx.core:core-splashscreen:1.0.0-alpha02'
splash.xml
<style name="Theme.App.Start" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">#FFF</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_baseline_baby_changing_station_24</item>
<item name="postSplashScreenTheme">@style/Theme.SplashScreenApi</item>
</style>
splash.xml (for dark mode)
<style name="Theme.App.Start" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">#3A3A3A</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_baseline_baby_changing_station_24</item>
<item name="postSplashScreenTheme">@style/Theme.SplashScreenApi</item>
</style>
Manifest.xml
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.App.Start">
<activity
android:name=".MainActivity"
android:exported="true"
android:theme="@style/Theme.App.Start">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
MainActivity.kt
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
installSplashScreen()
setContentView(R.layout.activity_main)
}
}
Still show the black icon in dark mode
And perfectly work in light mode
Device Name: Xiaomi Redmi Note 7 Pro,
Android Version: Android 10 (SDK 29)