Skip to content

Instantly share code, notes, and snippets.

@mortenjust
Last active September 18, 2015 03:04
Show Gist options
  • Save mortenjust/d9a5a159a2ba6107cec1 to your computer and use it in GitHub Desktop.
Save mortenjust/d9a5a159a2ba6107cec1 to your computer and use it in GitHub Desktop.
Add a launcher image
<application
android:theme="@style/Theme.Wearable.Launcher" >
// this is a drawable
<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="@color/app_color"/>
<item>
<bitmap
android:src="@drawable/launcher_logo"
android:gravity="center"/>
</item>
</layer-list>
// Overall strategy: 1. Create a new theme just for launching 2. Add it to the manifest 3. Switch it back as the first thing in the main activity's OnCreate
// switch back to the real theme before super.oncreate and before setcontentview in the main activity
// https://plus.google.com/+AndroidDevelopers/posts/Z1Wwainpjhd?e=-RedirectToSandbox
@Override
protected void onCreate(Bundle savedInstanceState) {
setTheme(R.style.Theme_Wearable);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_watch_face);
<resources>
<style name="Theme.Wearable.Launcher">
<item name="android:windowBackground">@drawable/launch_screen</item>
</style>
// ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment