Skip to content Skip to sidebar Skip to footer

Android Layout Folders For Different Screen Sizes

I have an app that I need to ensure different devices are pulling from different layout folders. I need a nexus 5 (1920 x 1080) to pull from a different folder than a Note 4 (2560

Solution 1:

Actually you need to add the following folders:

  • layout-sw320dp (xhdpi devices)
  • layout-sw340dp (xxhdpi devices)
  • layout-sw380dp (xxxhdpi devices)

you must add folders only if you really need another whole layout in different devices. Other than that , use only default layout folder with proper layout structure and extract dimensions on different density folders.

Solution 2:

So this seems to be the only arrangement that worked for me...

layout (Nexus 4 & 5)

layout-sw440dp-port (Note 4, Nexus 6)

layout-sw720dp-port (Samsung 10" tablet)

(It I take off the "port" it doesn't work...) ;-)

Thanx for all the suggestions!

Solution 3:

According to Google device metrics, Note 4 and Nexus 5 both have xxhdpi density, but their widths and heights are different, so you should try playing with the smallestWidth qualifier. For example with this combination should work: layout-sw360dp & layout-sw480dp (You can read more about qualifiers here)

Solution 4:

This is the structure:

    res/layout
    res/layout-large
    res/layout-xlarge
    res/layout-sw600dp
    res/layout-sw720dp
    res/layout-sw800dp

Post a Comment for "Android Layout Folders For Different Screen Sizes"