如何设置Android的动态壁纸图标(又名"缩略图") [英] How to set the Android Live Wallpaper icon (aka "thumbnail")
问题描述
我建我的第一个Android应用程序。
这是一个动态壁纸设计为2.2。
当我preSS并按住屏幕中,选择壁纸
,然后选择动态壁纸
,我的生活壁纸有什么看起来像我居住的壁纸覆盖名称的默认图标。
如何设置这个图标?
我的清单文件有指定为 @绘制/图标的应用程序图标
更新
我想我需要添加一些信息到这个问题,因为它不好描述我的问题(对不起)。
- 在我所有的
RES / drawable- [HML] DPI /
图标。我叫他们全部的icon.png
。 - 在我的清单文件中包含
<应用机器人:标签=@字符串/ APP_NAME机器人:图标=@可绘制/图标>
- 在我也曾尝试在
RES /绘制/
名为的icon.png
。李创造一个48x48的图标> - 我也试图明确添加其它明显标记的图标,如果他们被允许。例如。服务,活动,意图过滤器(这应该是显而易见的,我不知道这个清单文件还真管用,所以我想任何东西)
- 在
管理应用程序
图标正常显示 - 当选择动态壁纸,图标显示不正确
-
MDPI
图标是48×48,LDPI
图标为36X36和华电国际
图标的72x72
为了看到在动态壁纸的菜单图标,则需要设置安卓缩略图
属性的应用程序<壁纸>
标记。这通常对应于扩展 WallpaperService
。
看着随SDK提供的 CubeLiveWallpaper
示例应用程序,我们可以看到该标签位于cube1.xml和cube2.xml。以下修改后的版本显示的图标thumb.png位于 RES /绘制
并提供strings.xml中定义的描述
<壁纸
的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:缩略图=@可绘制/拇指
机器人:说明=@字符串/描述
机器人:settingsActivity =com.example.android.livecubes.cube2.CubeWallpaper2Settings
/>
注:该作品无论文件扩展名,假设格式是支持的类型 - JPG。 PNG等
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 Live Wallpapers
, my live wallpaper has what looks like a default icon with the name of my live wallpaper overlaid.
How do I set this icon?
My manifest file has an application icon specified as @drawable/icon
Update
I think I need to add some info to this question as it poorly describes my problem (sorry).
- I have all the
res/drawable-[hml]dpi/
icons. I named them allicon.png
. - My manifest file contains
<application android:label="@string/app_name" android:icon="@drawable/icon">
- I have also tried creating a 48x48 icon in
res/drawable/
calledicon.png
. - I have also tried explicitly adding icons in other manifest tags if they are allowed. eg. service, activity, intent-filter (It should be obvious that I don't know how this manifest file really works, so I was trying anything)
- In
Manage Applications
, the icon is displayed correctly. - When selecting the Live Wallpaper, the icon is not displayed correctly.
mdpi
icon is 48x48,ldpi
icon is 36x36 andhdpi
icon is 72x72
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
这篇关于如何设置Android的动态壁纸图标(又名&QUOT;缩略图&QUOT;)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!