简体   繁体   English

Android不同的屏幕尺寸

[英]Android Different Screen Sizes

I'm working in Android Studio, this app is aiming to target devices from API 10, several features I am using for supporting old and new devices I am getting from appcompat library. 我正在Android Studio中工作,此应用程序旨在针对API 10中的设备,这是我用来支持从appcompat库中获得的旧设备和新设备的几种功能。

When I test in my phone, the app design seems Ok, but I know I have to mantain compatibility for other devices, like tablets. 当我在手机中进行测试时,应用程序设计似乎还可以,但是我知道我必须保持与其他设备(例如平板电脑)的兼容性。 Untill now, I only have created folders in drawable, for different screen densities (mdpi, ldpi, xhdpi...). 到目前为止,我只在可绘制的文件夹中创建了不同屏幕密度(mdpi,ldpi,xhdpi ...)的文件夹。

The point is how can I support different sizes (ie one layout for small phones, other for tablets...). 关键是我如何支持不同的尺寸(例如,一种用于小型电话的布局,另一种用于平板电脑的布局...)。 I heard about create folders in layout like small, medium and large, but in Google developers site, this is not recommended, I should use intead sw...dp, however it seems is supported only for api 13 and above. 我听说过以小,中,大布局创建文件夹,但是不建议在Google开发人员网站中使用,我应该使用intead sw ... dp,但是似乎仅支持api 13及更高版本。

I am considering make an app for phones and other for tablets, unless there is something I can do, keeping support for api 10 and above and supporting different screen sizes. 我正在考虑开发一款适用于手机和平板电脑的应用程序,除非我可以做些什么,请保持对api 10及更高版本的支持并支持不同的屏幕尺寸。

As you said, in the android documentation you can find ( http://developer.android.com/intl/es/guide/practices/screens_support.html ): 如您所说,您可以在android文档中找到( http://developer.android.com/intl/es/guide/practices/screens_support.html ):

A set of four generalized sizes: small, normal, large, and xlarge Note: Beginning with Android 3.2 (API level 13), these size groups are deprecated in favor of a new technique for managing screen sizes based on the available screen width. 一组四个通用尺寸:small,normal,large和xlarge注意:从Android 3.2(API级别13)开始,不赞成使用这些尺寸组,而是推荐一种新技术来根据可用屏幕宽度来管理屏幕尺寸。 If you're developing for Android 3.2 and greater, see Declaring Tablet Layouts for Android 3.2 for more information. 如果您正在为Android 3.2及更高版本进行开发,请参阅声明Android 3.2的平板电脑布局以了解更多信息。

It tells you to not use them just if you are designing for API 13 and above. 它告诉您不要仅在为API 13及更高版本进行设计时使用它们。 If you don't then you should use the deprecated identifiers. 如果不这样做,则应使用不建议使用的标识符。

I don't think make an app for an API lower than 15 has much sense, here you can see some charts of API distribution: http://developer.android.com/intl/es/about/dashboards/index.html 我认为制作API低于15的应用程序没有多大意义,在这里您可以看到一些API分布图: http : //developer.android.com/intl/es/about/dashboards/index.html

With API 15 you are covering the 96.4% of the users. 使用API​​ 15,您可以覆盖96.4%的用户。

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

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