views:

553

answers:

2

I am nearly finished with the development of an Android application. But there seems to be a problem. When I started working on the project I used only the default 1.5 device resolution which is 320x480. But now when I am in the testing phase I started testing in 480x800 and 480x854 in both 1.5 and 2.0. These resolutions are not defined in 1.5 AVD manager, so I used the provided tools to create my own. I set the resolution plus the new dpi (240 for the big displays and 16o for the small ones). So here is what happened when I tested it all.

In 1.5 when I set my constants to a high resolution and I run the app with the specific AVD I get proportional and well-aligned components, but the images have the same resolution and the text fonts keep their size as well. Of course the whole layout stretches, so now I have longer lines in my ListActivity.

In 2.0 on the other hand, I made no changes in the constants at all. But the situation there was that the appearance of the application remained the same. The images were stretched in order to fit their newly expanded containers, but everything looked like on the original resolution I was developing the app, only bigger.

My question is why and how did this happen? There are some modifications in 2.0 regarding the layout but what exactly are they? And how can I get my app to look the same in 1.5 just like in 2.0?

The situation is difficult for me to describe, and I can't post any screenshots because of legal issues. So if you need any clarification please don't hesitate to ask. All help is appreciated. Thank you.

P.S. When I mean tests, I mean on the emulator only. No real devices have been used.

+2  A: 

To quote myself:

If your application is compiled for Android 1.5 or lower, Android will assume your application was designed to look good on the classic screen size and resolution. Android will then automatically do the following:

  • If your application is installed on a device with a larger screen, Android will run your application in "compatibility mode", scaling everything based on the actual screen size. So, suppose you have a 24px square PNG file, and Android install and runs your application on a device with the standard physical size but a WVGA resolution (a so-called "high-density" screen). Android might scale your PNG file to be 36px when it displays it, so it will take up the same visible space on the screen. On the plus side, Android handles this automatically; on the minus side, bitmap scaling algorithms tend to make the images a bit fuzzy.
  • Android will block your application from running on a device with a smaller screen. Hence, QVGA devices, like the HTC Tattoo, will be unable to get your application, even if it is available on the Android Market.

If your application is compiled for Android 1.6 or higher, Android assumes that you are properly handling all screen sizes, and therefore will not run your application in "compatibility mode".

I recommend that you read the following:

(NOTE: the AndroidGuys links may load a little slow -- their site has been having some issues)

The quoted passage is from the third bulleted item above.

CommonsWare
A: 

Take a look at the android documentation on Supporting Multiple Screens. Basically the 1.5 SDK has only truly meant to display HVGA content, the 1.6 SDK is the first release that truly supports multiple resolutions.

FTA:

Android 1.5 and earlier versions of the platform were designed to support a single screen configuration — HVGA (320x480) resolution on a 3.2" screen.

...

Starting from Android 1.6, the platform adds support for multiple screen sizes and resolutions, reflecting the many new types and sizes of devices on which the platform will run.

So basically don't worry about multiple resolutions in Android 1.5, I always compile my code with the 1.6SDK for the multiple resolution support but set the minimumSDK to be 1.5 in order to reach a much wider audience of users.

snctln
Thank you all very much! This is exactly the information I needed :)
Boris Rusev