Skip to content

Instantly share code, notes, and snippets.

@liminal
Created January 2, 2018 09:42
Show Gist options
  • Save liminal/240095c679dc57108b6b9b3782ca0cc5 to your computer and use it in GitHub Desktop.
Save liminal/240095c679dc57108b6b9b3782ca0cc5 to your computer and use it in GitHub Desktop.
<?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>
<?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>
class MainActivity: AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
// Make sure this is before calling super.onCreate
setTheme(R.style.AppTheme)
super.onCreate(savedInstanceState)
// …
}
}
<?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