Add a splash screen

If your app implements a custom splash screen or uses a launcher theme, migrate your app to the SplashScreen library, available in Jetpack, to ensure it displays correctly on all Wear OS versions.

See step by step implementation instructions on this page to learn how to add a splash screen using the SplashScreen library such that the screen meets design guidelines.

Add dependencies

Add the following dependency to your app module's build.gradle file:

Groovy

dependencies{
implementation"androidx.core:core-splashscreen:1.2.0"
}

Kotlin

dependencies{
implementation("androidx.core:core-splashscreen:1.2.0")
}

Make sure you are using version 1.0.1 or higher, to get support for default Wear OS dimensions.

Add a theme

Create a splash screen theme in res/values/styles.xml. The parent element depends on the icon's shape:

  • If the icon is round, use Theme.SplashScreen.
  • If the icon is a different shape, use Theme.SplashScreen.IconBackground.

Use windowSplashScreenBackground to fill the background with a single black color. Set the values of postSplashScreenTheme to the theme that the Activity should use and windowSplashScreenAnimatedIcon to a drawable or animated drawable:

<resources>
<stylename="Theme.App"parent="@android:style/Theme.DeviceDefault"/>
<stylename="Theme.App.Starting"parent="Theme.SplashScreen">
<!--Setthesplashscreenbackgroundtoblack-->
<itemname="windowSplashScreenBackground">@android:color/black</item>
<!--UsewindowSplashScreenAnimatedIcontoaddadrawableorananimated
drawable.-->
<itemname="windowSplashScreenAnimatedIcon">@drawable/splash_screen</item>
<!--SetthethemeoftheActivitythatfollowsyoursplashscreen.-->
<itemname="postSplashScreenTheme">@style/Theme.App</item>
</style>
</resources>

If you use a non-round icon, you need to set a white background color underneath your icon. In this case, use the Theme.SplashScreen.IconBackground as parent theme and set the windowSplashScreenIconBackgroundColor attribute:

<stylename="Theme.App.Starting"parent="Theme.SplashScreen">
<!--Setawhitebackgroundbehindthesplashscreenicon.-->
<itemname="windowSplashScreenIconBackgroundColor">@android:color/white</item>
</style>

The other attributes are optional.

Create a drawable for the theme

Splash screen themes requires a drawable to pass into the windowSplashScreenAnimatedIcon attribute. For example, you can create it by adding a new file res/drawable/splash_screen.xml and using app launcher icon and correct splash screen icon size:

<layer-listxmlns:android="http://schemas.android.com/apk/res/android">
<item
android:width="@dimen/splash_screen_icon_size"
android:height="@dimen/splash_screen_icon_size"
android:drawable="@mipmap/ic_launcher"
android:gravity="center"/>
</layer-list>

The splash screen icon size is defined in res/values/dimens.xml and differs depending whether the icon is round:

<resources>
<!--Roundappiconcantakeallofdefaultspace-->
<dimenname="splash_screen_icon_size">48dp</dimen>
</resources>

...or non-round and therefore must use the icon background:

<resources>
<!--Non-roundiconwithbackgroundmustusereducedsizetofitcircle-->
<dimenname="splash_screen_icon_size">36dp</dimen>
</resources>

Specify the theme

In your app's manifest file (AndroidManifest.xml), replace the theme of the starting activity -- usually the ones that define a launcher item or are otherwise exported -- to the theme you created in the previous step:

<activity
android:name=".snippets.SplashScreenActivity"
android:exported="true"
android:taskAffinity=""
android:theme="@style/Theme.App.Starting">
<!--...-->
</activity>

Update your starting activity

Install your splash screen in the starting activity before calling super.onCreate():

classSplashScreenActivity:ComponentActivity(){
overridefunonCreate(savedInstanceState:Bundle?){
installSplashScreen()
super.onCreate(savedInstanceState)
setContent{
WearApp()
}
}
}

Additional resources

Learn more about splash screens in general and how you can use them in your app.

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年12月29日 UTC.