Android wallpaper/background dimensions
Asked Answered
M

3

11

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!

Michaella answered 6/1, 2010 at 1:26 Comment(0)
M
27

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.

Monopode answered 6/1, 2010 at 7:1 Comment(4)
Thanks Romain! Nice to see Google's Android developers here.Michaella
Is this still true for the newer UI's?Titanium
Is this also true for tablet UI's?Messene
@Romain Guy: Any chance you can comment on this?Specter
A
3

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.

Amidase answered 6/1, 2010 at 1:42 Comment(2)
Thanks for the swift reply. However, at least the backgrounds that come with the device are larger than the screen resolution. This allows the background to move when you swipe left or right on the home screen and change the page. I believe the height matches the screen resolution, but not the width, which is equal or larger to the biggest dimension, as the background moves both in portrait and landscape mode.Michaella
Oops, quite right.. I was going to say that you need to have a background with at least the biggest dimension squared. I have an HTC Hero which doesn't do landscape on the home screen, so I haven't really investigated how the swipe/width issue is handled.Amidase
P
0

Don't guess, ask the WallpaperManager:

  manager = WallpaperManager.getInstance(this);
  width = manager.getDesiredMinimumWidth();
  height = manager.getDesiredMinimumHeight();
Peritonitis answered 18/11, 2015 at 12:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.