# androidx.core.splashscreen

*** ** * ** ***

This Splash Screen library provides compatibility support for the `android.window.SplashScreen` APIs down to API 21, with support of the splash screen icon from API 23.

It is composed of a compatibility theme `https://developer.android.com/reference/androidx/core/splashscreen/R.style#Theme_SplashScreen()` that needs to be set as the starting theme of the activity and a programmatic API in `https://developer.android.com/reference/androidx/core/splashscreen/SplashScreen`.

To use it, the theme of the launching Activity must inherit from `Theme.SplashScreen`

*AndroidManifest.xml:*

```
    <manifest...>
        <application>
        <activity>
             android:name=".MainActivity"
             android:theme="@style/Theme.App.Starting"/>
     </manifest>
```
*res/values/styles.xml:*

```
<resources>
    <style name="Theme.App" parent="...">
    ...
    </style>

   <style name="Theme.App.Starting" parent="Theme.SplashScreen">
       <item name="windowSplashScreenBackground">@color/splashScreenBackground</item>
       <item name="windowSplashScreenAnimatedIcon">@drawable/splashscreen_icon</item>
       <item name="windowSplashScreenAnimationDuration">2000</item>
       <item name="postSplashScreenTheme">@style/Theme.App</item>
</resources>
```
*MainActivity.java:*

```
    class MainActivity : Activity {
        fun onCreate() {
            super.onCreate()
            val splashScreen = installSplashScreen()

            // Set the content view right after installing the splash screen
            setContentView(R.layout.main_activity)
        }
    }
```

## Interfaces

|---|---|
| `https://developer.android.com/reference/androidx/core/splashscreen/SplashScreen.KeepOnScreenCondition` | Condition evaluated to check if the splash screen should remain on screen |
| `https://developer.android.com/reference/androidx/core/splashscreen/SplashScreen.OnExitAnimationListener` | Listener to be passed in `https://developer.android.com/reference/androidx/core/splashscreen/SplashScreen#setOnExitAnimationListener(androidx.core.splashscreen.SplashScreen.OnExitAnimationListener)`. |

## Classes

|---|---|
| `https://developer.android.com/reference/androidx/core/splashscreen/R` |   |
| `https://developer.android.com/reference/androidx/core/splashscreen/R.attr` |   |
| `https://developer.android.com/reference/androidx/core/splashscreen/R.dimen` |   |
| `https://developer.android.com/reference/androidx/core/splashscreen/R.style` |   |
| `https://developer.android.com/reference/androidx/core/splashscreen/SplashScreen` | Provides control over the splash screen once the application is started. |
| `https://developer.android.com/reference/androidx/core/splashscreen/SplashScreenViewProvider` | Contains a copy of the splash screen used to create a custom animation from the splash screen to the application. |