Last active
June 17, 2020 16:21
-
-
Save Pinaki93/1d8416e6fda8e3ca8c7976e26765d429 to your computer and use it in GitHub Desktop.
Code snippets for Creating Splash Screen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
<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> | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onCreate(savedInstanceState: Bundle?) { | |
setTheme(R.style.AppTheme) | |
setContentView(...) | |
.... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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