如何包括 10"和 7"布局正确 [英] How to include 10" and 7" layouts properly
问题描述
Nexus 7:7" 1280x800
Nexus 7: 7" 1280x800
银河标签 10.1 10" 1280x800
Galaxy tab 10.1 10" 1280x800
我希望我的应用能够在 7 英寸和 10 英寸平板电脑上运行.据我所知,我必须在我的应用程序中包含这些布局文件夹:
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:
适用于 7 英寸平板电脑
for 7 inch tablets
- layout-sw600dp
- layout-sw600dp-port
适用于 10 英寸平板电脑
for 10 inch tablets
- layout-sw720dp
- layout-sw720dp-port
它在 nexus 7 上运行良好,但在 10 英寸平板电脑上加载 sw600dp 布局.
It runs fine on the nexus 7, but loads the sw600dp layouts on the 10" tablet.
如果我包含这些默认文件夹:
If I include these default folders:
- 布局
- 布局端口
10" 星系标签从这些加载布局.
10" galaxy tab loads layouts from these.
如果我只包含默认布局文件夹和 sw600dp 文件夹,它会在 nexus7 上崩溃.
If I only include the default layout folders and the sw600dp one, it crashes on the nexus7.
如果 10 英寸 Galaxy 选项卡无法加载 sw720p 布局,我该如何支持手机、7 英寸平板电脑和 10 英寸平板电脑?
How am I supposed to support phones, 7" tablets and 10" tablets, if the 10" galaxy tab won't load the sw720p layouts?
格式化
推荐答案
问题是,我没有默认布局文件夹.
The problem was, that I had no default layout folder.
我尝试过,只使用 sw600dp 和 sw720dp 文件夹.我仍然不知道为什么它们不起作用,但我不在乎.无论如何,我不能使用 swxxxdp <3.2,所以搞砸了.
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.
因此,如果您想编写一个必须支持手机(2.2+)、7 英寸平板电脑和 10 英寸平板电脑的应用,请使用以下老式的东西:
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 适用于 7" 平板电脑(适用于模拟器和 nexus7)
layout-large for 7" tablet (works on emulator and nexus7)
layout-xlarge 用于 10" 平板电脑(适用于模拟器和 Galaxytab10.1)
layout-xlarge for 10" tablet (works on emulator and galaxytab10.1)
其他人也得出了同样的结论.
这篇关于如何包括 10"和 7"布局正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!