views:

1131

answers:

2

I'm creating a splash screen that will display while my Android application loads. I'd like to create it at the correct size so Android won't auto-scale it up or down to fit the screen. (It's a bitmap image, a photograph of an oil painting, so I can't just turn it into a nine-patch.)

But there are at least three important screen sizes I care about: 320x480, 480x854 (Droid), and 480x800 (Nexus One).

I've read the documentation on supporting multiple screen sizes, but I still don't see how I'm supposed to configure different splash screens for Droid/Nexus one (they're both "hdpi" resources as far as Android is concerned), and I don't know exactly how large my splash screen should be in any case. (How tall is the OS title bar/menu in Droid? N1?)

What size should I make these images, and how do I tell Android to use the correct size on a given screen?

+4  A: 
Christopher
In my case, my image isn't a logo; it's a bitmap portrait (it's a photograph of an oil painting). Converting this painting into a nine-patch image is not an option.
Dan Fabulich
If it's an image like that, I guess you'd wouldn't want to stretch it. So I'd scale it to the most common resolution for each density, and allow it to have a transparent (or other) border where there's more screen space available.
Christopher
Adding a border looks weird. Instead, I'd like to define two resources: one for 480x800, and another for 480x854. Is that possible?
Dan Fabulich
In a way, yes. See the updated answer above.
Christopher
+4  A: 

Okay, firstly: you can find the device model via android.os.Build and use that to determine which image to show.

Secondly, I personally wouldn't bother. Layouts should be done in dip since every android screen is 320x480 dip I believe, and android maintains aspect ratio among devices very well through this in my experience. A 480x800 splash set to fill parent has been pretty reliable on both N1 and the droid as far as I have encountered.

jqpubliq
You don't need to look at `Build` to find out the screen resolution or density. The aspect ratios can also vary quite wildly between devices; this is why there are the `long` and `notlong` resource attributes. Anyway, none of this matters as we have the `drawable-xdpi` folders and nine-patch images :)
Christopher
Went back through the supporting multiple screens document and you have a really good point. `long` and `notlong` were issues I completely missed. Could you post some screens of your nine-patch solution in the extreme cases so I can get a feel of how this method will fare for splashes that are pictures ect?
jqpubliq
You say "pretty reliable," but when you're working with bitmap images like mine (a photograph of an oil painting) there's noticeable distortion at 480x800 vs. 480x854. I'd like to define two resources, one for 480x800 and another for 480x854. Is that possible?
Dan Fabulich
There are so many Android models these days that using android.os.Build is not a reasonable way to determine screen resolution.
Dan Fabulich