Android壁纸/背景尺寸
各种 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
壁纸的宽度是纵向模式下设备宽度的两倍。因此,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.
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 thesetResource()
method — the resource must be aBitmap
and so not a nine-patch or other type ofDrawable
.不要猜测,问问WallpaperManager:
Don't guess, ask the WallpaperManager: