3

I have an image that I want to place on the background on my activity. For the G1 I would use a background of 320x480 but with the nexus 1 the resolution is almost double that. Should I just place the large image and make the smaller phones size down? I am trying to keep the size of my package down as much as possible.

Janusz
  • 187,060
  • 113
  • 301
  • 369
jax
  • 37,735
  • 57
  • 182
  • 278

2 Answers2

2

If it's a simple colour or a gradient, you can share the same drawable for all screen resolutions.

If it's a more complex graphic, then you should create separate images for different screen resolutions (or densities) by placing them in the appropriate directories (e.g. "drawable-nodpi", "drawable-hdpi" etc.).

Christopher Orr
  • 110,418
  • 27
  • 198
  • 193
  • OK, thanks...however, wouldn't having 2 images instead of 1 bulk up my file size? Why not just use the the large one and let android resize? CPU is not an issue at the moment. – jax Feb 02 '10 at 11:49
  • Well you can try it for yourself on the emulator; the graphic may well look nasty when scaled up or down. But surely your background graphic isn't that large anyway -- I wouldn't say there's any reason to worry about APK size unless it's heading towards multiple megabytes... – Christopher Orr Feb 02 '10 at 14:05
0

A repeatable background image can be the best way to handle device resolution compatibility for simple patterns:

How to make android app's background image repeat

Community
  • 1
  • 1
J0hnG4lt
  • 4,337
  • 5
  • 24
  • 40