Skip to content

Instantly share code, notes, and snippets.

@Pinaki93
Last active June 17, 2020 16:21
Show Gist options
  • Save Pinaki93/1d8416e6fda8e3ca8c7976e26765d429 to your computer and use it in GitHub Desktop.
Save Pinaki93/1d8416e6fda8e3ca8c7976e26765d429 to your computer and use it in GitHub Desktop.
Code snippets for Creating Splash Screen
...
<activity
android:name=".LauncherActivity"
android:theme="@style/AppTheme.Splash">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
...
override fun onCreate(savedInstanceState: Bundle?) {
setTheme(R.style.AppTheme)
setContentView(...)
....
}
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque">
<!-- The desired background color for splash theme -->
<item android:drawable="@color/splashThemeBackground"/>
<!-- Colored brand icon or the launcher icon of size 144dp -->
<item>
<bitmap
android:src="@drawable/ic_brand_logo_144dp"
android:gravity="center"/>
</item>
</layer-list>
<style name="AppTheme.Splash" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Add the drawable that we created in the last screen here -->
<item name="android:windowBackground">@drawable/splash_drawable</item>
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment