我正确添加布局吗?

时间:2015-01-31 14:01:56

标签: android layout density-independent-pixel

在我之前对我国十大手机和平板电脑进行研究后,我可以将它们分类如下:

HANDSETS:
533dp x 320dp
640dp x 360dp
853dp x 480dp  

TABLETS:
1280dp x 800dp
960dp x 600dp  

因此,鉴于我支持API级别11及以上,我将需要包括指定布局和新布局的旧方法。因此,对于旧版本,我的布局将如下所示:

res/layout/my_layout.xml             // layout for normal screen size ("default")
res/layout-small/my_layout.xml       // layout for small screen size
res/layout-large/my_layout.xml       // layout for large screen size
res/layout-xlarge/my_layout.xml      // layout for extra large screen size
<< and the corresponding landscape >>   

sw<N>dp的新版本看起来像这样(对于手机):

res/layout-sw320dp/my_layout.xml
res/layout-sw360dp/my_layout.xml
res/layout-sw480dp/my_layout.xml
<< and the landscape >>
res/layout-sw320dp-land/my_layout.xml
res/layout-sw360dp-land/my_layout.xml
res/layout-sw480dp-land/my_layout.xml  

所以,问题如下:

  1. 我是否正确添加了具有较新限定符的布局?
  2. 官方文档将426dp x 320dp470dp x 320dp列为正确的屏幕尺寸示例。我有一个相当奇怪的533dp x 320dp。我在计算DP大小时出错了吗?
  3. 默认布局是否只需要限定符,或者是否为过度杀伤?

0 个答案:

没有答案