Skip to content Skip to sidebar Skip to footer

Resolution Support In Android 2.0

Received an email from my first Motorola Droid user. The new 480x854 resolution introduced in Android 2.0 (as opposed to 320x480) is wreaking havoc with my user interfaces. Everyth

Solution 1:

Which dimension units did you use?

AFAIK using dp and sp should keep you safe.

From documentation:

dp Density-independent Pixels - an abstract unit that is based on the physical density of the screen. These units are relative to a 160 dpi screen, so one dp is one pixel on a 160 dpi screen. The ratio of dp-to-pixel will change with the screen density, but not necessarily in direct proportion. Note: The compiler accepts both "dip" and "dp", though "dp" is more consistent with "sp".

sp Scale-independent Pixels - this is like the dp unit, but it is also scaled by the user's font size preference. It is recommend you use this unit when specifying font sizes, so they will be adjusted for both the screen density and user's preference.

Solution 2:

The eclair emulator works wonders for these issues, also make sure to read:

http://developer.android.com/guide/practices/screens_support.html

Your application responds to different resolutions based on many factors, even the min-sdk. Also, from the page, are some best practices:

  1. Prefer wrap_content, fill_parent and the dip unit to px in XML layout files
  2. Avoid AbsoluteLayout
  3. Do not use hard coded pixel values in your code
  4. Use density and/or resolution specific resources

Solution 3:

Aside from the resolution difference, the other thing to consider is that the Droid's WVGA screen has a different aspect ratio from previous devices like the G1. In many older apps that I've downloaded, this manifests as a gap at the bottom of the screen, or elements that are vertically misaligned in portrait mode. You may want to try running your app in the emulator with a WVGA skin to check for any hidden assumptions that your layout makes about the aspect ratio.

Post a Comment for "Resolution Support In Android 2.0"