Skip to content Skip to sidebar Skip to footer

Different Layouts For Multiple Screens

I have created the different folders for multiple screens.. res/layout (for normal screens) res/layout-large (for large screens) res/layout-xlarge (for xhdpi screens) when i have t

Solution 1:

You are wrong saying "res/layout-xlarge (for xhdpi screens)". If you want to make different layouts attending to densities you should use hdpi, xhdpi, xxhdpi and xxxhdpi modifiers:

...
res/layout-hdpi --->forHDPI screens.
res/layout-xxdpi --->forXHDPI screens.
res/layout-xxhdpi --->forXXHDPI screens.
...

large and xlarge modifiers were used (since Android 3.2 they are deprecated, meaning you should the modifiers above) to group devices in function of their size.

More information at http://developer.android.com/guide/practices/screens_support.html

Solution 2:

Try Layout folder like :

layout             // layout for normal screen size ("default")
layout-large       // layout for large screen size
layout-xlarge      // layout for extra-large screen size
layout-xlarge-land // layout for extra-large in landscape orientation

add support-screens in AndroidManifest.xml :

<supports-screens android:resizeable=["true"| "false"]
          android:smallScreens=["true" | "false"]
          android:normalScreens=["true" | "false"]
          android:largeScreens=["true" | "false"]
          android:xlargeScreens=["true" | "false"]
          android:anyDensity=["true" | "false"]
          android:requiresSmallestWidthDp="integer"
          android:compatibleWidthLimitDp="integer"
          android:largestWidthLimitDp="integer"/>

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

Post a Comment for "Different Layouts For Multiple Screens"