Android layouts - Would it be reasonable to create more Layout Folders than sw320, sw480 sw600 sw720 sizes?

1.6k views Asked by At

In order to support different screen sizes in an Android App, I have created different layout versions: sw320, sw480 sw600 sw720

But I notice that many mobile smartphones takes the version of sw320 while they do represent the page differently.

For example when running on the following devices: Nexus One and Samsung Galaxy s7 both takes (from some reason) the sw320, Why is that?

And would it be reasnable to add more layout versions to the code?

1

There are 1 answers

7
CommonsWare On

Nexus One and Samsung Galaxy s7 both takes (from some reason) the sw320, Why is that?

The Nexus One was an hdpi device with a screen resolution of 800 x 480 pixels. Its shortest width is 480 pixels, which is 320dp.

The Samsung Galaxy S7 should be an xxxhdpi device, and its screen resolution is 2560 x 1440. Its shortest width is 1440 pixels, which is 360dp.

Hence, both devices fall within your -sw320dp bucket, given your other buckets.

And would it be reasnable to add more layout versions to the code?

IMHO, you should have fewer versions, not more. You should be using layouts that are more fluid and can adapt to small variations in screen size. Having different layout resources entirely should be reserved for cases where a major change in UI is called for (e.g., the classic master/detail pattern implementation, between phones and tablets).