Do I need 14 different layouts to support all Android devices?

AndroidScreenResolutionAndroid Screen-Support

Android Problem Overview


I'm really feeling confused. From the http://developer.android.com/guide/practices/screens_support.html#qualifiers">docs</a> at developer.android.com, it seems in order to keep my images scaled correctly (aspect ratio too) across all current Android devices I need all these layouts below. Is that really what everyone is doing? Am I missing something, or should I be going about this a different way?

> Low density Small screens QVGA 240x320 > ------------------------------------------------ > layout-small-ldpi > layout-small-land-ldpi >
> Low density Normal screens WVGA400 240x400 (x432) > ------------------------------------------------ > layout-ldpi > layout-land-ldpi >
> Medium density Normal screens HVGA 320x480 > ------------------------------------------------ > layout-mdpi > layout-land-mdpi >
> Medium density Large screens HVGA 320x480 > ------------------------------------------------ > layout-large-mdpi > layout-large-land-mdpi >
> High density Normal screens WVGA800 480x800 (x854) > ------------------------------------------------ > layout-hdpi > layout-land-hdpi >
> Xoom (medium density large but 1280x800 res) > ------------------------------------------------ > layout-xlarge > layout-xlarge-land

Android Solutions


Solution 1 - Android

Your app will work on 100% of the devices with the classic layout.

You can just add some buttons or change the layout in landscape mode by adding some qualifiers but that's up to you!

For instance, on LDPI (small resolution) device, you may want to adjust some buttons or change a little bit to fit the small screen.

You may also want to put some buttons on the right in landscape mode and in the bottom of your layout in portrait!

You do not "have to" use them.

Solution 2 - Android

According to Android Dev Protip from Roman Nurik about screen size qualifiers:

> If you have custom layouts for larger screen devices such as tablets, > now's the time to stop using the -large or -xlarge resource qualifier > and switch to using -swXXdp or -wXXdp qualifiers. The latter were > introduced in API level 13, which basically all tablets now have > support for according to the latest platform version charts1. > > means that for basically all cases where -large would have any effect, > -swXXdp can be used instead to provide more granularity. > > So which actual sw or w qualifiers should you use? Here's a quick > just-give-me-something starting point: > > 7" tablets: Instead of layout-large, use layout-sw600dp. > > Example: Nexus 7 = 960×600 dp; the smaller of the two dimensions is > 600. > > 10" tablets: Instead of layout-xlarge, use layout-sw720dp. > > Example: Nexus 10 = 1280×800 dp; the smaller of the two dimensions is > 800. Some 10" tablets are a bit more narrow so 720 is a commonly used switching point. > > There's more to it than just that (you really want to choose switching > points based on your content's minimum requirements, not on device > form factor), but that's a #Protip for another day (::cough:: +Nick > Butcher ::cough::).

Solution 3 - Android

In the layout if you do not use AbsoluteLayout, you application is going to be resized to fit the screen.

But in some cases, for smaller screens you need declare a new layout with less components for example.

For images:

You has some options.

Simple ignore some resolutions and let the device choose the best image to it. Declare on AndroidManifest for wich sizes you want to support. Or has just one and let the resize screw your application.

Solution 4 - Android

Yes. You should define different layout for different screen resolution.

When you are supposed to work with tablet kind of application. That time really you feel that. There is a need of different layout. Because Tablets always comes in different size.

One more thing, When you are working on android, means you should always taste your app with real device. And also test with different size emulators.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionwufooView Question on Stackoverflow
Solution 1 - AndroidWaza_BeView Answer on Stackoverflow
Solution 2 - AndroidLOG_TAGView Answer on Stackoverflow
Solution 3 - AndroidMarcos VasconcelosView Answer on Stackoverflow
Solution 4 - AndroidshivaprakashView Answer on Stackoverflow