Question

Today, i read much information on android's multi-screen document. I doubt that android support multi-screen on QVGA, HVGA and WVGA when you use 'dp' unit on the xml layout.Does the android support the same density but different resolution? For example, i define a xml layout for mdip. Can this layout be used on 480x800 and 320x480 resolution?

Thank You.

Was it helpful?

Solution

To answer your question: Yes, that layout could be used on various resolutions.

If you're using density based layouts and drawables, they can be used across all kinds of screen sizes. Examples of mdpi (160):

  • Normal screen: HVGA (320x480)
  • Large screen: WVGA800 (480x800), WVGA854 (480x854), 600x1024
  • Xtra large screen: WXGA (1280x800), 1024x768, 1280x768

They might be different resolutions, but the density is approximately the same (mdpi). If you want to create layouts for each specific screen size, you can use normal-mdpi, large-mdpi and xlarge-mdpi.

There's a lot of information available on the subject at the Android Developer site: http://developer.android.com/guide/practices/screens_support.html

I'd suggest you go ahead and do a lot of testing with the various SDK templates. That helped me a lot when I was in your situation.

OTHER TIPS

It does depend on how you specify your layout, and it might or not suffice specifying a single layout.

A dip is no more than a measure which scales depending on the type of a screen.

If for instance, you determine that a view has a height of 400dip, it will represent 400px in a mdpi screen, 300px in a ldpi screen and 600px in a hdpi screen.

Since you'll get around a lot by using relative constraints (such as fill_parent/match_parent or wrap_content) and relative positioning, most layouts will actually scale without you needing to do anything.

If you find yourself a lot needing to manually specify your layout element sizes, you might eventually stumble into a few layouts that you might need to rethink or to reimplement.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top