tags:

views:

19

answers:

1

Hi all,

I created a background .png for my application in GIMP. It's resolution is 640x480, which from googling, seems to be the resolution for a default emulator. My problem is when I apply the background to the RelativeLayout with android:background=@drawable/bg and run it, there are lots of artifacts in the image. As if the emulator could not provide enough colors to display the .png correctly. What is going on here?

P.S. This image is nothing to fancy, just simple lines and radial gradients.

A: 

It's resolution is 640x480, which from googling, seems to be the resolution for a default emulator

640x480 is not even an officially-supported resolution in Android, let alone a "default" one. Here is the list of supported resolutions.

Also, you want to watch your color depth. I forget the details, but not everything can necessarily handle 24-bit color, due to LCD limitations.

CommonsWare
Android seems to only support 16-bit color.
dfetter88
Also, if the image is placed in /res/raw/ as opposed to res/drawable/ it will not be optimized at buildtime. This provides some improvement to image quality.
dfetter88
@dfetter88: that sounds like you are experiencing automatic resizing of the images for different screen densities. Ideally, you provide original images per density. If not, use `raw/drawable-nodpi/` to have a drawable resource that will not be rescaled.
CommonsWare