问题
I want my app to have a specific layout for Android tablets and another for mobiles.
In order to do this, I have created two layout files in two folders, like this:
layout/main.xml
and
layout-large/main.xml
I want the small layout to be applied to Galaxy Note. However, the large layout is applied (which is normal, since its resolution qualifies it as large screen). Since this layout does not fit well to Galaxy Note's screen size, is there a way to apply the 'normal' layout to Galaxy Note?
回答1:
Galaxy Note has actually a 'large' screen. 'large' means the size between ~4.5" and 7".
So I would recommend to use your tablet-layout only on 'xlarge' devices (>7"): layout-xlarge/main.xml
For more info, have a look at this dev guide page.
回答2:
If you want to differentiate between different size tablets (like the nexus 7 and galaxy tab), you'll still need to have the large and xlarge folders.
I think a better way to do this is to use this specific folder for the Note:
layout-large-port-xhdpi-1280x800
You can be pretty confident that future tablets won't be grouped into this folder. Since they are larger than the Note, if they are 1280x800 resolution, they won't be considered xhdpi.
Also, new versions of the Note are classified as normal size now, so I'd imagine this to be the trend for future phones of this size.
回答3:
You can also try to use a folder with name:
layout-sw600dp
Regards, Quentin
回答4:
That's because since layout-large does not match the screen you want (this case tablet which is xlarge) it will go to the default layout which is located in layout/
Check here http://developer.android.com/guide/practices/screens_support.html
来源:https://stackoverflow.com/questions/9826803/large-layout-affects-galaxy-note