如何设置Android的动态壁纸图标(又名"缩略图") [英] How to set the Android Live Wallpaper icon (aka "thumbnail")

查看:356
本文介绍了如何设置Android的动态壁纸图标(又名"缩略图")的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建我的第一个Android应用程序。

这是一个动态壁纸设计为2.2。

当我preSS并按住屏幕中,选择壁纸,然后选择动态壁纸,我的生活壁纸有什么看起来像我居住的壁纸覆盖名称的默认图标。

如何设置这个图标?

我的清单文件有指定为 @绘制/图标的应用程序图标

更新

我想我需要添加一些信息到这个问题,因为它不好描述我的问题(对不起)。

  1. 在我所有的 RES / drawable- [HML] DPI / 图标。我叫他们全部的icon.png
  2. 在我的清单文件中包含<应用机器人:标签=@字符串/ APP_NAME机器人:图标=@可绘制/图标>
  3. 在我也曾尝试在 RES /绘制/ 名为的icon.png
  4. 我也试图明确添加其它明显标记的图标,如果他们被允许。例如。服务,活动,意图过滤器(这应该是显而易见的,我不知道这个清单文件还真管用,所以我想任何东西)
  5. 管理​​应用程序图标正常显示
  6. 当选择动态壁纸,图标显示不正确
  7. MDPI 图标是48×48, LDPI 图标为36X36和华电国际图标的72x72
解决方案

为了看到在动态壁纸的菜单图标,则需要设置安卓缩略图属性的应用程序<壁纸> 标记。这通常对应于扩展 WallpaperService

类中的XML文件中找到

看着随SDK提供的 CubeLiveWallpaper 示例应用程序,我们可以看到该标签位于cube1.xml和cube2.xml。以下修改后的版本显示的图标thumb.png位于 RES /绘制并提供strings.xml中定义的描述

 <壁纸
    的xmlns:机器人=htt​​p://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).

  1. I have all the res/drawable-[hml]dpi/ icons. I named them all icon.png.
  2. My manifest file contains <application android:label="@string/app_name" android:icon="@drawable/icon">
  3. I have also tried creating a 48x48 icon in res/drawable/ called icon.png.
  4. 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)
  5. In Manage Applications, the icon is displayed correctly.
  6. When selecting the Live Wallpaper, the icon is not displayed correctly.
  7. mdpi icon is 48x48, ldpi icon is 36x36 and hdpi 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆