在对我国排名前 10 位的手机和平板电脑进行了之前的研究后,我可以将它们分类如下:
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
所以,这里有几个问题:
- 我是否正确添加了具有较新限定符的布局?
- 官方文档声明
426dp x 320dp
并470dp x 320dp
以适当的屏幕尺寸为例。我有一个比较奇怪的533dp x 320dp
。我在计算 DP 大小时出错了吗? - 甚至不需要限定符的默认布局还是过度杀伤?