1

Does anyone know how to manage background images for android applications?

I have my backgrounds looking pretty sweet in my app, however, when ported to another device they are stretched to fit and look awefull.

So my question is how do i specify my background image size in dp to account for the ever changing range of devices??

any help would be great - thanks.

Deano
  • 176
  • 1
  • 12

2 Answers2

2

use 9patch images . this will allow you to bound background image according to foreground contents . see 9patch drawable docs here .

Shailendra Singh Rajawat
  • 8,172
  • 3
  • 35
  • 40
  • okay, i have gone through the tut and im able to create images which need a little tweaking but is pretty much what i want. However, since using the new .p.png file all my buttons have dissapeared!! – Deano Nov 01 '11 at 13:45
  • have found the answer http://stackoverflow.com/questions/3904852/android-layout-broken-with-9-patch-background by adding this line to the layout android:padding="0dip" – Deano Nov 01 '11 at 14:09
1

Please have a look on How to support Multiple screen devices in android

You may have to create different layouts and also different drawable folders to support different resolutions and different size of screen.

Sunil Kumar Sahoo
  • 53,011
  • 55
  • 178
  • 243