如何设置 Android 动态壁纸图标(又名“缩略图”)

发布于 2024-09-14 13:48:37 字数 850 浏览 1 评论 0原文

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

它是专为2.2设计的动态壁纸。

当我按住屏幕时,选择壁纸,然后选择动态壁纸,我的动态壁纸看起来像默认图标,上面覆盖着我的动态壁纸的名称。

如何设置这个图标?

我的清单文件有一个指定为 @drawable/icon 的应用程序图标

更新

我认为我需要向这个问题添加一些信息,因为它没有很好地描述我的问题(抱歉)。

  1. 我有所有 res/drawable-[hml]dpi/ 图标。我将它们全部命名为 icon.png
  2. 我的清单文件包含
  3. 我还尝试在 res/ 中创建 48x48 图标drawable/ 名为 icon.png
  4. 如果允许的话,我还尝试在其他清单标记中显式添加图标。例如。服务、活动、意图过滤器(很明显,我不知道这个清单文件是如何工作的,所以我尝试了任何方法)
  5. 管理应用程序中,图标正确显示
  6. 选择动态壁纸时,图标显示不正确
  7. mdpi 图标为 48x48,ldpi 图标为 36x36,hdpi 图标为 72x72

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

少钕鈤記 2024-09-21 13:48:37

为了在动态壁纸菜单中看到图标,您需要为应用程序 标记设置 android:thumbnail 属性。通常可以在与扩展 WallpaperService 的类对应的 XML 文件中找到该文件。

查看随 SDK 提供的 CubeLiveWallpaper 示例应用程序,我们发现该标记位于cube1.xml 和cube2.xml 中。下面的修改版本显示位于 res/drawable 中的图标thumb.png,并提供在 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"
/>

注意:无论文件扩展名如何,假设格式是受支持的类型 - jpg,这都有效。 PNG等

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

攒眉千度 2024-09-21 13:48:37

您还可以将 @drawable/icon 更改为 @drawable/

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

意中人 2024-09-21 13:48:37

我已经在 AndroidManifest.xml 中设置了 ,它对于我在

/res/ 中使用的每个 icon.png 都工作正常可绘制- :== hdpi | LDPI | mdpi

文件夹。

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.

定格我的天空 2024-09-21 13:48:37

创建您的图标并将其保存在 res/drawable/icon.png 中。您还可以使用 icon.jpgicon.gificon.bmp

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

天荒地未老 2024-09-21 13:48:37

在 res/drawables 目录中,您将看到 icon.png。您将此文件更改为您想要的图标。 hdpi 适用于高密度设备,例如 Nexus 或 EVO。 mdpi 适用于 myTouch 或 G1 等设备

inside the res/drawables directories you will see icon.png. you change this file to be the icon you want. the hdpi are for the devices with high density, like the nexus one, or evo. mdpi is for devices like the myTouch or G1

咋地 2024-09-21 13:48:37

有关分辨率的更多信息,请参阅此帖子

本节特别是:

...使用的分辨率似乎比启动器图标大很多
分辨率,使用 48 表示中或 72 表示高会产生非常模糊的效果
模拟器和真实设备上的图像,让我想到那里
是否正在进行一些缩放...

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...

樱娆 2024-09-21 13:48:37

不支持将动画 .GIF 文件作为应用程序启动器图标。 Gif 图标不会给你任何计算错误,但动画不会工作。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文