Android: Splash Screen API showing empty

Issue

I am trying to impelement a splash screen.

I have followed the splash screen api approach implemented the implementation "androidx.core:core-splashscreen:1.0.0-alpha01"

then used the following style

<style name"SplashTheme" parent"Theme.AppCompat.DayNight.NoActionBar">
        <item name"windowSplashScreenBackground">@color/black</item>
        <item name"windowSplashScreenAnimatedIcon">@drawable/ic_search</item>
        <item name"postSplashScreenTheme">@style/Theme.AppTheme</item>
    </style>

then set the theme in the mainActivity in the manifest.xml

 <activity
            android:name".ui.main.MainActivity"
            android:exported"true"
            android:theme"@style/SplashTheme"
</activity>

and used the method intallSpalshScreen in the onCreated func

override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        installSplashScreen()

        toolbar  binding.viewToolbar.tbToolbar

compileSDKVersion in 31

screenshot

But the splash screen just shows a blank screen

Is there something i missed or any other way around this please let me know.

Solution

I guess you need to change the parent of the splashTheme from

parent"Theme.AppCompat.DayNight.NoActionBar"

to

 parent"Theme.SplashScreen"

Answered By – akhil nair

Leave a Comment