SplashScreen - Android Developers
SplashScreen - Android Developers
SplashScreen
Artifact: androidx.core:core-splashscreen (/jetpack/androidx/releases/core)
View Source
(https://cs.android.com/search?
q=file:androidx/core/splashscreen/SplashScreen.kt+class:androidx.core.splashscreen.SplashScreen)
Added in 1.0.0 (/jetpack/androidx/releases/core#1.0.0)
Kotlin | Java (/reference/androidx/core/splashscreen/SplashScreen)
Provides control over the splash screen once the application is started.
On API 31+ (Android 12+) this class calls the platform methods.
Prior API 31, the platform behavior is replicated with the exception of the Animated Vector
Drawable support on the launch screen.
2. In your manifest, set the theme attribute of the whole <application> or just the
starting <activity> to Theme.App.Starting
https://developer.android.com/reference/kotlin/androidx/core/splashscreen/SplashScreen 1/7
8/9/24, 10:30 AM SplashScreen | Android Developers
Themes
The library provides two themes: R.style.Theme_SplashScreen
(/reference/kotlin/androidx/core/splashscreen/R.style#Theme_SplashScreen()) and
R.style.Theme_SplashScreen_IconBackground
(/reference/kotlin/androidx/core/splashscreen/R.style#Theme_SplashScreen_IconBackground()) . If
you wish to display a background right under your icon, the later needs to be used. This
ensure that the scale and masking of the icon are similar to the Android 12 Splash Screen.
Note: This has no impact on the time during which the splash screen is displayed and is
only used in SplashScreenViewProvider.iconAnimationDurationMillis
(/reference/kotlin/androidx/core/splashscreen/SplashScreenViewProvider#iconAnimationDurationMilli
s())
. If you need to display the splash screen for a longer time, you can use
SplashScreen.setKeepOnScreenCondition
(/reference/kotlin/androidx/core/splashscreen/SplashScreen#setKeepOnScreenCondition(androidx.co
re.splashscreen.SplashScreen.KeepOnScreenCondition))
Known incompatibilities:
https://developer.android.com/reference/kotlin/androidx/core/splashscreen/SplashScreen 2/7
8/9/24, 10:30 AM SplashScreen | Android Developers
On API 21-22, The icon isn't displayed until the application starts, only the
background is visible.
Design
The splash screen icon uses the same specifications as Adaptive Icons
(https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive) . This means
that the icon needs to fit within a circle whose diameter is 2/3 the size of the icon. The
actual values don't really matter if you use a vector icon.
Specs
With icon background ( Theme.SplashScreen.IconBackground )
Example: if the full size of the image is 300dp*300dp, the icon needs to fit within a circle
with a diameter of 200dp. Everything outside the circle will be invisible (masked).
Summary
https://developer.android.com/reference/kotlin/androidx/core/splashscreen/SplashScreen 3/7
8/9/24, 10:30 AM SplashScreen | Android Developers
Nested types
Creates a SplashScreen
(/reference/kotlin/androidx/core/splashsc
associated with this Activity
(https://developer.android.com/reference
setting the theme to R.attr.postSplas
(/reference/kotlin/androidx/core/splashsc
.
Public functions
Unit setKeepOnScreenCondition
(https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/- (/reference/kotlin/androidx/core/splashscreen/Splash
unit/index.html) (condition: SplashScreen.KeepOnScreenCon
Unit setOnExitAnimationListener
(https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/- (/reference/kotlin/androidx/core/splashscreen/Splash
unit/index.html) (
https://developer.android.com/reference/kotlin/androidx/core/splashscreen/SplashScreen 4/7
8/9/24, 10:30 AM SplashScreen | Android Developers
Public functions
listener: SplashScreen.OnExitAnimati
)
Public functions
https://developer.android.com/reference/kotlin/androidx/core/splashscreen/SplashScreen 5/7
8/9/24, 10:30 AM SplashScreen | Android Developers
The splash will stay visible until the condition isn't met anymore. The condition is
evaluated before each request to draw the application, so it needs to be fast to avoid
blocking the UI.
Parameters
Sets a listener that will be called when the splashscreen is ready to be removed.
If a listener is set, the splashscreen won't be automatically removed and the application
needs to manually call SplashScreenViewProvider.remove
(/reference/kotlin/androidx/core/splashscreen/SplashScreenViewProvider#remove()) .
IF no listener is set, the splashscreen will be automatically removed once the app is ready
to draw.
https://developer.android.com/reference/kotlin/androidx/core/splashscreen/SplashScreen 6/7
8/9/24, 10:30 AM SplashScreen | Android Developers
Parameters
See also
setKeepOnScreenCondition
(/reference/kotlin/androidx/core/splashscreen/SplashScreen#setKeepOnScreenCondition(androidx.cor
SplashScreen.OnExitAnimationListener (/reference/kotlin/androidx/core/splashscreen/SplashSc
SplashScreenViewProvider (/reference/kotlin/androidx/core/splashscreen/SplashScreenViewProvid
Content and code samples on this page are subject to the licenses described in the Content License
(/license). Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://developer.android.com/reference/kotlin/androidx/core/splashscreen/SplashScreen 7/7