Created
January 2, 2018 09:42
-
-
Save liminal/240095c679dc57108b6b9b3782ca0cc5 to your computer and use it in GitHub Desktop.
Android Splash Screen Launcher Theme (based on https://android.jlelse.eu/the-complete-android-splash-screen-guide-c7db82bce565 )
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | |
<application> | |
<!-- Set AppTheme.Launcher for launcher activity --> | |
<activity | |
android:name=".MainActivity" | |
android:theme=”@style/AppTheme.Launcher”> | |
<intent-filter> | |
<action android:name="android.intent.action.MAIN"/> | |
<category android:name="android.intent.category.LAUNCHER"/> | |
</intent-filter> | |
</activity> | |
<!-- ... --> | |
</application> | |
<!-- ... --> | |
</manifest> |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<!-- The android:opacity=”opaque” line — this is critical in preventing a flash of black as your theme transitions. --> | |
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque"> | |
<!-- The background color, preferably the same as your normal theme --> | |
<item android:drawable="@android:color/white"/> | |
<!-- Your product logo - 144dp color version of your app icon --> | |
<item> | |
<bitmap | |
android:src="@drawable/product_logo_144dp" | |
android:gravity="center"/> | |
</item> | |
</layer-list> |
This file contains hidden or 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
class MainActivity: AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
// Make sure this is before calling super.onCreate | |
setTheme(R.style.AppTheme) | |
super.onCreate(savedInstanceState) | |
// … | |
} | |
} |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<!-- Your AppTheme or other themes/styles here --> | |
<!-- The launcher theme. It sets the main window background to the launch_screen drawable --> | |
<style name=”AppTheme.Launcher”> | |
<item name=”android:windowBackground”>@drawable/launch_screen</item> | |
<!-- Optional, on Android 5+ you can modify the colorPrimaryDark color to match the windowBackground color for further branding--> | |
<!-- <item name="colorPrimaryDark">@android:color/white</item> --> | |
</style> | |
</resources> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment