How to set the Android Live Wallpaper icon (aka “thumbnail”)

前端 未结 7 2338
独厮守ぢ
独厮守ぢ 2021-02-19 05:01

I built my first Android app.

It is a Live Wallpaper designed for 2.2.

When I press and hold the screen, select Wallpapers and then select L

相关标签:
7条回答
  • 2021-02-19 05:27

    In order to see an icon in the live wallpaper menu, you need to set the android:thumbnail attribute for the applications <Wallpaper> tag. This will normally be found in the XML file corresponding to the class that extends WallpaperService.

    Looking at the CubeLiveWallpaper sample application provided with the SDK, we see this tag to be located in cube1.xml and cube2.xml. A modified version below displays the icon thumb.png located in res/drawable and provides a description defined in strings.xml

    <wallpaper 
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:thumbnail="@drawable/thumb"
        android:description="@string/description"
        android:settingsActivity="com.example.android.livecubes.cube2.CubeWallpaper2Settings"
    />
    

    NOTE: this works regardless of file extension, assuming that the format is a supported type - jpg. png etc

    0 讨论(0)
  • 2021-02-19 05:33

    Create your icon and save it in res/drawable/icon.png. You can also use icon.jpg, icon.gif, or icon.bmp.

    0 讨论(0)
  • 2021-02-19 05:43

    Animated .GIF file is not supported as Application launcher icon. Gif icon wont give you any compluation error but animation wont work.

    0 讨论(0)
  • 2021-02-19 05:48

    You can also change @drawable/icon to @drawable/<youricon>

    0 讨论(0)
  • 2021-02-19 05:50

    I've set <application android:icon="@drawable/icon"/> in my AndroidManifest.xml and it's working fine for each icon.png I'm using in the

    /res/drawable- :== hdpi | ldpi | mdpi

    folders.

    0 讨论(0)
  • 2021-02-19 05:50

    More info about resolution can be found in this thread.

    This section especially:

    ...The resolution used seems to be a lot larger than the launcher icon resolution, using 48 for medium or 72 for high gives a very blurred image on both the emulator and real devices, leading me to think there is some scaling going on...

    0 讨论(0)
提交回复
热议问题