The first thing the user sees when launching your application is the splash screen. It not only forms the first impression, but also masks the loading time of the main content. You can implement a high-quality screensaver in several ways - from a simple static image to animated screens with a logo. However, many developers make critical mistakes: they use heavy graphic files, ignore adaptation to different screen resolutions, or incorrectly configure the display time. Android Studio You can implement a high-quality screensaver in several ways - from a simple static image to animated screens with a logo. However, many developers make critical mistakes: they use heavy graphic files, ignore adaptation to different screen resolutions, or incorrectly configure the display time.
In this article we will look at three main methods for creating screensavers in 2026: through Theme.AppCompat (Google's recommended approach), using Activity, and with using the library SplashScreen API for Android 12+. You will learn how to avoid common bugs, optimize performance and make a screensaver that will work correctly on 99% of devices - from budget smartphones to flagships with 144 Hz displays.
Why the standard approach with Activity is outdated
Previously, screensavers in Android were implemented through a separate SplashActivity, which was launched first and through Handler().postDelayed() went to the main screen. This method is still found in outdated tutorials, but it has critical drawbacks:
- โ ๏ธ Application launch delay โan artificial wait of 2-3 seconds irritates users and increases the failure rate.
- ๐ Performance issues is unnecessary
Activityoccupies memory and can cause ANR (Application Not Responding) on weaker devices. - ๐จ Inconsistency with Material Design guidelines โGoogle recommends using themed screensavers (
WindowBackground) instead of individual screens.
With the release Android 12 (API 31) Google presented an official SplashScreen APIthat solves these problems. However, to support older versions of Android (up to 11 inclusive), the custom theme method is still relevant. Next we will analyze both approaches.
Method 1: Screensaver through a custom theme (supports Android 5.0+)
This is the most universal method that works on all versions of Android. The essence of the method: we create a special theme with a background image, which is applied to the main one Activity before it is completely loaded. Advantages:
- โ
No unnecessary
Activity- saves memory. - โ Instant display of the splash screen - the user does not see a white screen.
- โ
Easy to adapt to different resolutions via
drawablefolders.
Implementation steps:
- Create a background image:
Recommended resolution:
1080ร1920 px(for portrait orientation). Save the file assplash_background.xmlin a folderres/drawable:<layer-list xmlns:android="http://schemas.android.com/apk/res/android"android:opacity="opaque">
<item
android:drawable="@color/colorPrimary"/>
<item>
<bitmap
android:gravity="center"
android:src="@mipmap/ic_launcher_foreground"/>
</item>
</layer-list>Here
ic_launcher_foregroundis your logo (must be in a vector for scaling). - Create a theme style:
In a file
styles.xmladd:<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar"><item name="android:windowBackground">@drawable/splash_background</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style> - Apply the theme in the manifest:
B
AndroidManifest.xmlfor your mainActivityspecify:<activityandroid:name=".MainActivity"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity> - Remove the theme after loading:
B method
onCreate()mainActivityadd:override fun onCreate(savedInstanceState: Bundle?) {setTheme(R.style.AppTheme) // Your main theme
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
The splash_background.xml file was created in drawable|The SplashTheme was added to styles.xml|Theme was applied to MainActivity in the manifest|In onCreate() the theme is changed to main-->
โ ๏ธ Attention: If you use Jetpack Compose, replacesetContentViewtosetContent {}, but the logic for changing the theme remains the same. Don't forget to test on devices with dark theme โthe splash screen background should adapt throughandroid:drawablewith the condition?attr/isLightTheme.
Method 2: SplashScreen API for Android 12+ (recommended by Google)
With the release of Android 12 Google introduced the official API for screensavers - android.window.SplashScreen. This method automatically adapts to system settings (including dynamic colors in Material You) and guarantees a smooth transition to the main content.
Advantages SplashScreen API:
- ๐ Optimized performance โthe splash screen is shown instantly, without delay.
- ๐จ Support for animations โ you can add a smooth appearance of the logo.
- ๐ฑ Adaptation for all devices โworks correctly with cutouts, rounded corners and navigation gestures.
Instructions for use implementations:
- Add a dependency to
build.gradle(Module: app):implementation 'androidx.core:core-splashscreen:1.1.0' - Create a theme for the splash screen to
themes.xml:<style name="Theme.App.SplashScreen" parent="Theme.SplashScreen"><item name="windowSplashScreenBackground">@color/purple_500</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_splash_logo</item>
<item name="postSplashScreenTheme">@style/Theme.App</item>
</style>Where
ic_splash_logois your logo in vector (.xmlor.webp). - Apply a theme in the manifest:
<activityandroid:name=".MainActivity"
android:theme="@style/Theme.App.SplashScreen"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity> - Initialize SplashScreen in
MainActivity:override fun onCreate(savedInstanceState: Bundle?) {super.onCreate(savedInstanceState)
installSplashScreen() // This line adds the splash screen
setContentView(R.layout.activity_main)
}
| Parameter | Description | Example value |
|---|---|---|
windowSplashScreenBackground |
Splash background color | @color/purple_500 |
windowSplashScreenAnimatedIcon |
Logo (supports animation) | @drawable/ic_splash_logo |
windowSplashScreenIconBackground |
Background color logo | @android:color/white |
windowSplashScreenBrandingImage |
Additional image (for example, slogan) | @drawable/branding_text |
For smooth animation of the logo, use AnimatedVectorDrawable. Create a file ic_splash_anim.xml in res/drawable and specify it in the parameter windowSplashScreenAnimatedIcon. Example of animation: gradual appearance of the logo with the effect fade-in.
โ ๏ธ Attention: On devices with Android 12+ the system animation of the application launch (launch animation) may conflict with your screensaver. To disable the system animation, add a parameter to the theme. <item name="android:windowSplashScreenBehavior">splashScreenStyle</item>.
Method 3: Animated screensaver with Lottie (for advanced effects)
If you need interactive or complex animation (for example, loading with a progress bar, animated mascot), use the library Lottie from Airbnb. It allows you to embed vector animations in the format .json without loss of performance.
Advantages Lottie:
- ๐ญ Any animations โfrom simple loading to complex scenes.
- ๐ฑ Light weight โthe file
.jsonweighs less than.gifor.mp4. - โก 60 FPS โsmoothness even on weak devices.
How to implement:
- Add dependency v
build.gradle:implementation 'com.airbnb.android:lottie:6.1.0' - Download the animation s site LottieFiles (for example, loading spinner or logo reveal).
- Create a separate one
SplashActivity:class SplashActivity : AppCompatActivity() {override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_splash)
val lottieAnimation = findViewById<LottieAnimationView>(R.id.lottie_splash)
lottieAnimation.playAnimation()
// Go to the main screen after the animation is completed
lottieAnimation.addAnimatorListener(object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator) {
startActivity(Intent(this@SplashActivity, MainActivity::class.java))
finish()
}
})
}
} - Add markup to
activity_splash.xml:<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:background="@color/white">
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/lottie_splash"
android:layout_width="200dp"
android:layout_height="200dp"
app:lottie_rawRes="@raw/splash_animation"
app:lottie_loop="false"/>
</LinearLayout>
How to optimize Lottie animation for Android
1. Reduce the number of keyframes in Adobe After Effects before exporting.
2. data-i="167">for acceleration on weak devices. app:lottie_renderMode="HARDWARE" for acceleration on weak devices.
3. For animations lasting >3 seconds, split the file into parts and download sequentially.
4. Test on devices with Android 8.0 โlags most often occur there.
โ ๏ธ Attention: If the animation Lottie weighs more 500 KB, this can significantly increase the size. Optimize the file through the tool.apk. Optimize the file through the tool Lottie Optimizer or convert toAnimatedVectorDrawablefor simple ones. effects.
Optimizing the splash screen: 7 rules for ideal UX
Even the most beautiful splash screen can spoil the impression of the application if it too slow or too flashy. Follow these rules:
- Display time โ 3 seconds:
Forget about
Handler().postDelayed(3000)! The splash screen should disappear as soon as the main content is loaded. UseViewTreeObserverto track the layout's readiness:view.viewTreeObserver.addOnPreDrawListener(object : ViewTreeObserver.OnPreDrawListener {
override fun onPreDraw(): Boolean {
return if (viewModel.isReady) {
view.viewTreeObserver.removeOnPreDrawListener(this)
true
} else {
false
}
}
}) - Adapt to the dark theme:
B
colors.xmladd alternative colors fornightfolders:<color name="splash_background">#FFFFFF</color><color name="splash_background">#121212</color> - Test on real devices:
The emulator will not show the real download speed. It is especially critical to test on:
- ๐ฑ Samsung Galaxy A-series (weak processors).
- ๐ฑ Xiaomi Redmi with MIUI (aggressive memory optimization).
- ๐ฑ Devices with
120 Hzdisplays (may flicker animation).
1. Show instantly (without a white screen).
2. Disappear immediately after loading content (do not wait for a fixed time).
3. Support all screen orientations (portrait/landscape).
4. Weigh no more than 1 MB (including animations).-->
Common mistakes and how to avoid them
Even experienced developers make mistakes when creating screensavers. Here TOP-5 bugs and their solutions:
| Error | Cause | Solution |
|---|---|---|
| The screensaver flashes before showing | White screen between the system launcher and yours Activity |
Use WindowBackground in the theme or SplashScreen API |
| Animation twitches | Too complex animation for the weak GPU | Simplify the animation or use HARDWARE render in Lottie |
| The splash screen does not disappear | Not called setTheme(R.style.AppTheme) in onCreate() |
Check order of calls to MainActivity |
| Blurry logo | Use a raster image instead of a vector | Convert logo to VectorDrawable (.xml) |
| Does not work on Android 12+ | Outdated method with Activity |
Migrate to SplashScreen API |
If your screensaver is does not work on a specific device, check:
- โ
Version Android (on Android 10 and below
SplashScreen APIis not supported). - โ
Availability
android:exported="true"in the manifest forMainActivity. - โ
Missing
android:noHistory="true"โthis may interrupt the animation.
FAQ: Answers to frequently asked questions
Is it possible to make a splash screen with a progress bar?
Yes, but this requires a separate SplashActivity with custom markup. Example:
<ProgressBarandroid:id="@+id/progressBar"
android:layout_width="match_parent"
android:layout_height="4dp"
android:indeterminate="false"
android:max="100"
android:progress="30"/>
Update progress in the background via AsyncTask or Coroutines.
How to make the splash screen transparent?
For a transparent splash screen in styles.xml use:
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
Please note that on some devices (for example Xiaomi) this may cause artifacts.
Why does the splash screen appear twice?
This happens if you use both a theme and a separate SplashActivity. Solution:
- Remove
SplashActivityfrom the manifest. - Leave only the method with a custom theme or
SplashScreen API.
How to add sound to the splash screen?
To play sound when showing screensavers:
val mediaPlayer = MediaPlayer.create(this, R.raw.splash_sound)
mediaPlayer.start()
โ ๏ธ Attention: The sound when starting an application can irritate users. Use it only if it is critical for branding (for example, in games).
How to test the screensaver on different devices without physical devices?
Use Firebase Test Lab for testing on virtual devices:
- Download
.apkto Firebase Console. - Select devices for the test (we recommend Pixel 4, Galaxy S10, Nexus 5X).
- Watch the video of the application launch.
This will help identify performance problems on weak devices.