Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
128 views
in Technique[技术] by (71.8m points)

android - How to include 10" and 7" layouts properly

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...