简体   繁体   English

Android 3.0 或更高版本应使用哪个布局限定符?

[英]Which layout qualifier should be used with Android 3.0 or above?

I was using layout normal , large , x-large but it was not working.我正在使用 layout normal , large , x-large但它不起作用。 I found out that Android works on the smallest dp.我发现 Android 适用于最小的 dp。 So I searched and found these two methods for layouts qualifier.所以我搜索并找到了这两种布局限定符的方法。

First method is to use layout-mdpi , layout-hdpi , layout-xhdpi , layout-xxhdpi .第一种方法是使用layout-mdpilayout-hdpilayout-xhdpilayout-xxhdpi Second method is to use layout-sw320dp , layout-sw480dp , layout-sw600dp , layout-sw720dp .第二种方法是使用layout-sw320dplayout-sw480dplayout-sw600dplayout-sw720dp

Now I am confused about which method is the standard way to use layout-qualifiers?现在我很困惑哪种方法是使用布局限定符的标准方法? I have searched around Google Docs Screen Density我搜索了Google Docs Screen Density

I am not able to get final decision what to use for layout from the above-mentioned methods我无法通过上述方法最终决定使用什么进行布局

Which layout qualifier (for different screen sizes) you should use does not depend on which Android Studio version you're using.您应该使用哪个布局限定符(针对不同的屏幕尺寸)并不取决于您使用的 Android Studio 版本。 It depends on what you need.这取决于你需要什么。

In your case, if you want to support devices (for different screen sizes ) which run on API level 12 or lower, you have to use the legacy size qualifiers (eg x-large ).在您的情况下,如果您想支持在 API 级别 12 或更低级别上运行的设备(适用于不同的屏幕尺寸),则必须使用旧的尺寸限定符(例如x-large )。 If you want to run it on devices using APIs above level 12, you can use the smallest and/or available width qualifier (eg w-600dp and sw-600dp respectively).如果您想在使用 12 级以上 API 的设备上运行它,您可以使用最小和/或可用的宽度限定符(例如分别w-600dpsw-600dp )。 Read more here . 在这里阅读更多 All the qualifiers in this paragraph are standardized;本段中的所有限定词都是标准化的; it just depends on what you need.这取决于你需要什么。

The qualifiers mdpi , hdpi , and so on are not used as qualifiers for different screen sizes layout, but for resources (in particular, images).限定符mdpihdpi不是用于不同屏幕尺寸布局的限定符,而是用于资源(特别是图像)的限定符。 This is so that Android can auto-generate versions of your rasterized images to display good graphical qualities for screens with different pixel densities .这样 Android 可以自动生成光栅化图像的版本,以便为具有不同像素密度的屏幕显示良好的图形质量

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

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