Stay organized with collections
Save and categorize content based on your preferences.
SplashScreen
interface SplashScreen
The interface that apps use to talk to the splash screen.
Each splash screen instance is bound to a particular Activity
. To obtain a SplashScreen
for an Activity, use Activity.getSplashScreen()
to get the SplashScreen.
Summary
Nested classes |
abstract |
Listens for the splash screen exit event.
|
Public methods |
abstract Unit |
Clear exist listener
|
abstract Unit |
Specifies whether an Activity wants to handle the splash screen animation on its own.
|
abstract Unit |
Overrides the theme used for the SplashScreen s of this application.
|
Constants
SPLASH_SCREEN_STYLE_SOLID_COLOR
static val SPLASH_SCREEN_STYLE_SOLID_COLOR: Int
Flag to be used with ActivityOptions.setSplashScreenStyle
, to avoid showing the splash screen icon of the launched activity
Value: 0
Public methods
clearOnExitAnimationListener
abstract fun clearOnExitAnimationListener(): Unit
Clear exist listener
setOnExitAnimationListener
abstract fun setOnExitAnimationListener(listener: SplashScreen.OnExitAnimationListener): Unit
Specifies whether an Activity
wants to handle the splash screen animation on its own. Normally the splash screen will show on screen before the content of the activity has been drawn, and disappear when the activity is showing on the screen. With this listener set, the activity will receive OnExitAnimationListener.onSplashScreenExit
callback if splash screen is showed, then the activity can create its own exit animation based on the SplashScreenView.
Note that this method must be called before splash screen leave, so it only takes effect during or before Activity.onResume
.
setSplashScreenTheme
abstract fun setSplashScreenTheme(themeId: Int): Unit
Overrides the theme used for the SplashScreen
s of this application.
By default, the SplashScreen
uses the theme set in the manifest. This method overrides and persists the theme used for the SplashScreen
of this application.
To reset to the default theme, set this the themeId to Resources.ID_NULL
.
Note: Internally, the theme name is resolved and persisted. This means that the theme name must be stable across versions, otherwise it won't be found after your application is updated.
Parameters |
themeId |
Int: The ID of the splashscreen theme to be used in place of the one defined in the manifest. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# SplashScreen\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nSplashScreen\n============\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/window/SplashScreen \"View this page in Java\") \n\n```\ninterface SplashScreen\n```\n\n|----------------------------------|\n| [android.window.SplashScreen](#) |\n\nThe interface that apps use to talk to the splash screen.\n\nEach splash screen instance is bound to a particular [Activity](../app/Activity.html#). To obtain a [SplashScreen](#) for an Activity, use `Activity.getSplashScreen()` to get the SplashScreen.\n\nSummary\n-------\n\n| Nested classes ||\n|----------|--------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract | [OnExitAnimationListener](/reference/kotlin/android/window/SplashScreen.OnExitAnimationListener) Listens for the splash screen exit event. |\n\n| Constants ||\n|-----------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [SPLASH_SCREEN_STYLE_ICON](#SPLASH_SCREEN_STYLE_ICON:kotlin.Int) Flag to be used with [ActivityOptions.setSplashScreenStyle](../app/ActivityOptions.html#setSplashScreenStyle(kotlin.Int)), to show the splash screen icon of the launched activity. |\n| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [SPLASH_SCREEN_STYLE_SOLID_COLOR](#SPLASH_SCREEN_STYLE_SOLID_COLOR:kotlin.Int) Flag to be used with [ActivityOptions.setSplashScreenStyle](../app/ActivityOptions.html#setSplashScreenStyle(kotlin.Int)), to avoid showing the splash screen icon of the launched activity |\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [clearOnExitAnimationListener](#clearOnExitAnimationListener())`()` Clear exist listener |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [setOnExitAnimationListener](#setOnExitAnimationListener(android.window.SplashScreen.OnExitAnimationListener))`(`listener:` `[SplashScreen.OnExitAnimationListener](/reference/kotlin/android/window/SplashScreen.OnExitAnimationListener)`)` Specifies whether an [Activity](../app/Activity.html#) wants to handle the splash screen animation on its own. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [setSplashScreenTheme](#setSplashScreenTheme(kotlin.Int))`(`themeId:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Overrides the theme used for the [SplashScreen](#)s of this application. |\n\nConstants\n---------\n\n### SPLASH_SCREEN_STYLE_ICON\n\nAdded in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val SPLASH_SCREEN_STYLE_ICON: Int\n```\n\nFlag to be used with [ActivityOptions.setSplashScreenStyle](../app/ActivityOptions.html#setSplashScreenStyle(kotlin.Int)), to show the splash screen icon of the launched activity. \n\n Value: 1\n\n### SPLASH_SCREEN_STYLE_SOLID_COLOR\n\nAdded in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val SPLASH_SCREEN_STYLE_SOLID_COLOR: Int\n```\n\nFlag to be used with [ActivityOptions.setSplashScreenStyle](../app/ActivityOptions.html#setSplashScreenStyle(kotlin.Int)), to avoid showing the splash screen icon of the launched activity \n\n Value: 0\n\nPublic methods\n--------------\n\n### clearOnExitAnimationListener\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun clearOnExitAnimationListener(): Unit\n```\n\nClear exist listener \n**See Also**\n\n- [#setOnExitAnimationListener](#setOnExitAnimationListener(android.window.SplashScreen.OnExitAnimationListener)) \n\n### setOnExitAnimationListener\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun setOnExitAnimationListener(listener: SplashScreen.OnExitAnimationListener): Unit\n```\n\nSpecifies whether an [Activity](../app/Activity.html#) wants to handle the splash screen animation on its own. Normally the splash screen will show on screen before the content of the activity has been drawn, and disappear when the activity is showing on the screen. With this listener set, the activity will receive [OnExitAnimationListener.onSplashScreenExit](/reference/kotlin/android/window/SplashScreen.OnExitAnimationListener#onSplashScreenExit(android.window.SplashScreenView)) callback if splash screen is showed, then the activity can create its own exit animation based on the SplashScreenView.\n\nNote that this method must be called before splash screen leave, so it only takes effect during or before [Activity.onResume](../app/Activity.html#onResume()).\n\n| Parameters ||\n|------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `listener` | [SplashScreen.OnExitAnimationListener](/reference/kotlin/android/window/SplashScreen.OnExitAnimationListener): the listener for receive the splash screen with This value cannot be `null`. |\n\n**See Also**\n\n- [android.window.SplashScreen.OnExitAnimationListener#onSplashScreenExit(SplashScreenView)](/reference/kotlin/android/window/SplashScreen.OnExitAnimationListener#onSplashScreenExit(android.window.SplashScreenView)) \n\n### setSplashScreenTheme\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun setSplashScreenTheme(themeId: Int): Unit\n```\n\nOverrides the theme used for the [SplashScreen](#)s of this application.\n\nBy default, the [SplashScreen](#) uses the theme set in the manifest. This method overrides and persists the theme used for the [SplashScreen](#) of this application.\n\nTo reset to the default theme, set this the themeId to [Resources.ID_NULL](../content/res/Resources.html#ID_NULL:kotlin.Int).\n\n**Note:** Internally, the theme name is resolved and persisted. This means that the theme name must be stable across versions, otherwise it won't be found after your application is updated.\n\n| Parameters ||\n|-----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `themeId` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The ID of the splashscreen theme to be used in place of the one defined in the manifest. |"]]