androidkotlinsplash-screenandroid-12

Splash screen api is showing action bar for android 12


After the splash screen loads, I am getting a action bar, but I have set postSplashScreenTheme to no action bar theme. This is happening only to android 12 emulator.

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
    <style name="Theme.App.Starting" parent="Theme.SplashScreen">
        <item name="windowSplashScreenBackground">@color/white</item>

        <item name="windowSplashScreenAnimatedIcon">@drawable/splash_icon</item>
        <item name="postSplashScreenTheme">@style/Theme.Design.NoActionBar</item>
        <item name="windowSplashScreenIconBackgroundColor">@color/blue</item>
        <item name="windowSplashScreenAnimationDuration">800</item>

        <item name="android:forceDarkAllowed" tools:targetApi="q">false</item>
    </style>
</resources>

Solution

  • Don't forget to call actionBar?.hide() before installSplashScreen() to hide the action bar before the main view is displayed.

        actionBar?.hide()
        val installSplash= installSplashScreen()