Last active
September 18, 2015 03:04
-
-
Save mortenjust/d9a5a159a2ba6107cec1 to your computer and use it in GitHub Desktop.
Add a launcher image
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
<application | |
android:theme="@style/Theme.Wearable.Launcher" > |
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
// 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> |
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
// 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); |
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
<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