开发者

How to add Icon for your Live Wallpaper

开发者 https://www.devze.com 2023-04-06 09:35 出处:网络
My live wallpaper has an Icon, it shows before you install it, but after you install it and you go to Wallpaper>Live Wallpaper, there is no icon in it, it\'s just an emp开发者_开发百科ty gray image.

My live wallpaper has an Icon, it shows before you install it, but after you install it and you go to Wallpaper>Live Wallpaper, there is no icon in it, it's just an emp开发者_开发百科ty gray image. My live wallpaper has an Icon, it shows before you install it, but after you install it and you go to Wallpaper>Live Wallpaper, there is no icon in it, it's just an empty gray image.

Here is my Manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:versionName="1.0" package="com.cutecats.cats" 
    android:versionCode="1">
    <uses-sdk android:minSdkVersion="8" />



    <uses-feature android:name="android.software.live_wallpaper" />
    <application
        android:icon="@drawable/icon" 
        android:label="@string/app_name">
        <service
            android:name=".CubeWallpaper1"
            android:icon="@drawable/icon"
            android:permission="android.permission.BIND_WALLPAPER">
            <intent-filter android:icon="@drawable/icon">
                <action android:name="android.service.wallpaper.WallpaperService" />
            </intent-filter>
            <meta-data android:name="android.service.wallpaper" android:resource="@xml/cube1" />
        </service>
        <activity
            android:label="@string/cube2_settings"
            android:name=".CubeWallpaper1Settings"
            android:icon="@drawable/icon"
            android:exported="true" >
        </activity>
    </application>
</manifest>


There are different types of icons for live wallpaper from what i understand. Each shows in its own time, and what you are talking about is actually a thumbnail and needs to be placed inside

      <wallpaper> 

tag. Here is how i did it: i created pony.xml file with following code:

     <?xml version="1.0" encoding="utf-8"?>
     <wallpaper xmlns:android="http://schemas.android.com/apk/res/android"
        android:thumbnail="@drawable/pony"
        android:description="@string/pony_desc"
     />

Inside manifest file i have following:

  <service android:label="@string/pony" android:name="my.pony.wallpaperManagement.SleepyPonyWallpaper"
     android:permission="android.permission.BIND_WALLPAPER">
     <intent-filter>
        <action android:name="android.service.wallpaper.WallpaperService" />
     </intent-filter>
     <meta-data android:name="android.service.wallpaper"
        android:resource="@xml/pony" />
  </service>

Note the reference to pony.xml.

Also, don't forget to have your icon in appropriate size (e.g. 64x64).

0

精彩评论

暂无评论...
验证码 换一张
取 消