How to include 10" and 7" layouts properly

berestom picture berestom · Feb 26, 2013 · Viewed 38.5k times · Source

Nexus 7: 7" 1280x800

Galaxy tab 10.1 10" 1280x800

I want my app to run on 7 and 10 inch tablets. As far as I know, I have to include these layout folders in my app:

for 7 inch tablets

  • layout-sw600dp
  • layout-sw600dp-port

for 10 inch tablets

  • layout-sw720dp
  • layout-sw720dp-port

It runs fine on the nexus 7, but loads the sw600dp layouts on the 10" tablet.

If I include these default folders:

  • layout
  • layout-port

10" galaxy tab loads layouts from these.

If I only include the default layout folders and the sw600dp one, it crashes on the nexus7.

How am I supposed to support phones, 7" tablets and 10" tablets, if the 10" galaxy tab won't load the sw720p layouts?

edit:formatting

Answer

berestom picture berestom · Feb 27, 2013

The problem was, that I had no default layout folder.

I tried getting by, using only the sw600dp and sw720dp folders. I still have no idea why they don't work, but I don't care. I can't use swxxxdp <3.2 anyway, so screw that.

So if you want to write an app, that has to support phones(2.2+), 7inch tablets and 10 inch tablets, use the following oldschool stuff:

layout this is the default, it is needed even if you don't plan to support phones!

layout-large for 7" tablet (works on emulator and nexus7)

layout-xlarge for 10" tablet (works on emulator and galaxytab10.1)

Other people have came to the same conclusion too.