Android壁纸/背景尺寸

发布于 2024-08-16 12:13:21 字数 172 浏览 11 评论 0原文

各种 Android 屏幕配置(低、中、高密度的小屏幕、普通屏幕和大屏幕)的主壁纸/背景的默认尺寸是多少?

壁纸是否支持 9 片 PNG 文件?我应该改用这些吗?

我在 API 级别 5 中找到了一种方法,可以为您提供壁纸的最小尺寸,但我也想支持以前版本的 Android。

谢谢!

Which are the default dimension of the Home wallpaper/background for the various Android screen configurations (small, normal and large screens with low, medium and high density)?

Are 9-patch PNG files supported for the wallpaper? Should I be using these instead?

I found a method in API level 5 that gives you the minimum size of the wallpaper, but I would like to support previous versions of Android as well.

Thanks!

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

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

发布评论

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

评论(3

一花一树开 2024-08-23 12:13:21

壁纸的宽度是纵向模式下设备宽度的两倍。因此,Nexus One 上为 960x800,Droid 上为 960x854,G1/Magic/Hero 上为 640x480,等等。

A wallpaper is twice as wide as the device held in portrait mode. So 960x800 on a Nexus One, 960x854 on a Droid, 640x480 on a G1/Magic/Hero, etc.

乄_柒ぐ汐 2024-08-23 12:13:21

Android 开发者网站上的这篇文章显示了屏幕分辨率的范围对于每个密度。

我相信壁纸必须与屏幕分辨率相匹配并且不能拉伸。例如,如果您创建一个具有高屏幕密度(如 480x854)的新模拟器,您就可以看到这一点。默认的主屏幕背景居中,顶部和底部有大的黑带。

WallpaperManager API 表示您必须使用 PNG 或 JPEG 格式的图像,即使您使用 setResource() 方法 - 资源必须是一个 位图< /code> 因此不是九个补丁或其他类型的 Drawable

This article on the Android Developers' site shows the range of screen resolutions for each density.

I believe the wallpapers have to match the screen resolution and are not stretched. You can see this if, for example, you create a new emulator with a high screen density like 480x854. The default home screen background is centred, with large black bands at the top and bottom.

The WallpaperManager API indicates that you must use a PNG- or JPEG-format image, even if you use the setResource() method — the resource must be a Bitmap and so not a nine-patch or other type of Drawable.

诗酒趁年少 2024-08-23 12:13:21

不要猜测,问问WallpaperManager:

  manager = WallpaperManager.getInstance(this);
  width = manager.getDesiredMinimumWidth();
  height = manager.getDesiredMinimumHeight();

Don't guess, ask the WallpaperManager:

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