简体   繁体   English

支持不同的屏幕,基于尺寸还是基于dpi?

[英]Supporting different screens, based on the dimension or based on the dpi?

I use API 7. I know there are two ways for my question: 我使用API​​7。我知道我的问题有两种方法:

1- using the layout-small and layout-normal and layout-large and layout-xlarge . 1-使用layout-smalllayout-normallayout-largelayout-xlarge

2- using the sw-320dpi and like this. 2-使用sw-320dpi ,就像这样。

When I see the all existing devices (tablet and phones) in the android studio, I understand it does not contain the all existing devices (tablet and phones) in marketplaces. 当我看到android studio中所有现有的设备(平板电脑和手机)时,我知道它不包含市场上所有现有的设备(平板电脑和手机)。 Now I want know your experience about my question. 现在,我想知道您对我的问题的经验。 If you want create an application that it uses the API 7, Which method you choose? 如果要创建使用API​​ 7的应用程序,请选择哪种方法? I do not want link from other websites, I want know your experience about supporting different screens? 我不想从其他网站链接,我想知道您在支持不同屏幕方面的经验吗? What is the best way? 什么是最好的方法?

you use api level 7 so you should use : 您使用的是api级别7,因此您应该使用:

layout-small, layout-normal, layout-large and layout-xlarge. 小型布局,普通布局,大型布局和xlarge。 because using sw-320dp ... begins with android 3.2(api level 13) 因为使用sw-320dp ...始于android 3.2(api级别13)

Take a look : 看一看 :

Beginning with Android 3.2 (API level 13), the above size groups are deprecated and you should instead use the swdp configuration qualifier to define the smallest available width required by your layout resources. 从Android 3.2(API级别13)开始,不建议使用上述大小组,而应使用swdp配置限定符定义布局资源所需的最小可用宽度。 For example, if your multi-pane tablet layout requires at least 600dp of screen width, you should place it in layout-sw600dp/. 例如,如果您的多窗格平板电脑布局需要至少600dp的屏幕宽度,则应将其放置在layout-sw600dp /中。 Using the new techniques for declaring layout resources is discussed further in the section about Declaring Tablet Layouts for Android 3.2. 关于声明Android 3.2平板电脑布局的部分中,将进一步讨论使用新技术声明布局资源。

http://developer.android.com/guide/practices/screens_support.html http://developer.android.com/guide/practices/screens_support.html

It's not sw320dpi , but sw320dp . 不是sw320dpi ,而是sw320dp This number doesn't represent screen density, but size in the same manner as small / normal etc. 此数字不代表屏幕密度,而是与small / normal等相同的尺寸。

See http://developer.android.com/guide/practices/screens_support.html 请参阅http://developer.android.com/guide/practices/screens_support.html

  • xlarge screens are at least 960dp x 720dp xlarge屏幕至少为960dp x 720dp
  • large screens are at least 640dp x 480dp 大屏幕至少为640dp x 480dp
  • normal screens are at least 470dp x 320dp 普通屏幕至少为470dp x 320dp
  • small screens are at least 426dp x 320dp 小萤幕至少为426dp x 320dp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM