`

【翻译】(64)supports-screens元素

 
阅读更多

【翻译】(64)supports-screens元素

 

see

http://developer.android.com/guide/topics/manifest/supports-screens-element.html

 

原文见

http://developer.android.com/guide/topics/manifest/supports-screens-element.html

 

-------------------------------

 

<supports-screens>

 

supports-screens元素

 

-------------------------------

 

* syntax:

 

* 语法:

 

-------------------------------

 

<supports-screens android:resizeable=["true"| "false"]

                  android:smallScreens=["true" | "false"]

                  android:normalScreens=["true" | "false"]

                  android:largeScreens=["true" | "false"]

                  android:xlargeScreens=["true" | "false"]

                  android:anyDensity=["true" | "false"]

                  android:requiresSmallestWidthDp="integer"

                  android:compatibleWidthLimitDp="integer"

                  android:largestWidthLimitDp="integer"/>

 

-------------------------------

 

* contained in:

 

* 被包含在:

 

<manifest>

 

* description:

 

* 描述:

 

Lets you specify the screen sizes your application supports and enable screen compatibility mode for screens larger than what your application supports. It's important that you always use this element in your application to specify the screen sizes your application supports.

 

让你指定你的应用程序支持的屏幕大小以及为比你的应用程序支持屏幕大的屏幕而使能屏幕兼容性模式。重要的是你总是在你的应用程中使用此元素以指定你的应用程序支持的屏幕大小。

 

An application "supports" a given screen size if it resizes properly to fill the entire screen. Normal resizing applied by the system works well for most applications and you don't have to do any extra work to make your application work on screens larger than a handset device. However, it's often important that you optimize your application's UI for different screen sizes by providing alternative layout resources. For instance, you might want to modify the layout of an activity when it is on a tablet compared to when running on a handset device.

 

一个应用程序“支持”一个给定屏幕大小如果它正确地改变大小以填充整个屏幕。被系统应用的普通改变大小对于大多数应用程序来说工作良好,而且你不必做任何额外的工作以让你的应用程序工作在大于手机设备的屏幕上。然而,常常重要的是你通过提供可选布局资源来为不同的屏幕大小优化你的应用程序用户界面。例如,你可能希望修改一个活动的布局当它是在一个平板上,对比起当它运行在一个手机屏幕上时。

 

However, if your application does not work well when resized to fit different screen sizes, you can use the attributes of the <supports-screens> element to control whether your application should be distributed to smaller screens or have its UI scaled up ("zoomed") to fit larger screens using the system's screen compatibility mode. When you have not designed for larger screen sizes and the normal resizing does not achieve the appropriate results, screen compatibility mode will scale your UI by emulating a normal size screen and medium density, then zooming in so that it fills the entire screen. Beware that this causes pixelation and blurring of your UI, so it's better if you optimize your UI for large screens.

 

然而,如果你的应用程序在它被改变大小以适应不同屏幕大小时工作得不好,那么你可以使用<supports-screens>元素的属性来控制你的应用程序是否应该被分发给较小屏幕或者让它的用户界面放大(“被缩放”)以适应较大屏幕,使用系统的屏幕兼容性模式。当你不曾为较大屏幕大小而设计,而且普通的改变大小不能达到合适的结果时,屏幕兼容性模式将通过模拟一个普通大小屏幕和中等密度来缩放你的用户界面,然后放大使它适应整个屏幕。请意识到这导致你的用户界面的像素化和模糊,所以如果你为大屏幕优化你的用户界面就比较好了。

 

-------------------------------

 

Note: Android 3.2 introduces new attributes: android:requiresSmallestWidthDp, android:compatibleWidthLimitDp, and android:largestWidthLimitDp. If you're developing your application for Android 3.2 and higher, you should use these attributes to declare your screen size support, instead of the attributes based on generalized screen sizes.

 

注意:Android 3.2引入新的属性:android:requiresSmallestWidthDp,android:compatibleWidthLimitDp,以及android:largestWidthLimitDp。如果你正在为Android 3.2和更高开发你的应用程序,你应该使用这些属性以声明你的屏幕大小支持,取代基于常规化屏幕大小的属性。

 

-------------------------------

 

For more information about how to properly support different screen sizes so that you can avoid using screen compatibility mode with your application, read Supporting Multiple Screens.

 

想获得关于如何正确地支持不同屏幕大小以使你可以避免对你的应用程序使用屏幕兼容性模式的更多信息,请阅读支持多屏幕。

 

* attributes:

 

* 属性:

 

* android:resizeable

 

Indicates whether the application is resizeable for different screen sizes. This attribute is true, by default. If set false, the system will run your application in screen compatibility mode on large screens.

 

指示应用程序是否可以为不同屏幕大小而改变大小。这个属性默认为true。如果设置为false,那么系统将在大屏幕上运行你的应用程序于屏幕兼容模式中。

 

This attribute is deprecated. It was introduced to help applications transition from Android 1.5 to 1.6, when support for multiple screens was first introduced. You should not use it.

 

这个属性被废弃。它被引入以帮助应用程序从Android 1.5过渡至1.6,当对多屏幕的支持被最先引入时。你不应该使用它。

 

* android:smallScreens

 

Indicates whether the application supports smaller screen form-factors. A small screen is defined as one with a smaller aspect ratio than the "normal" (traditional HVGA) screen. An application that does not support small screens will not be available for small screen devices from external services (such as Android Market), because there is little the platform can do to make such an application work on a smaller screen. This is "true" by default.

 

指示应用程序是否支持较小的屏幕规格。一个小屏幕被定义为一个带有比“普通”(传统的HVGA)屏幕的纵横比要小的屏幕。一个不支持小屏幕的应用程序将对于小屏幕设备从外部服务(诸如Android市场)中不可用,因为平台只能做极少的事情让这个应用程序可以在一个较小的屏幕上工作。默认为"true"。

 

* android:normalScreens

 

Indicates whether an application supports the "normal" screen form-factors. Traditionally this is an HVGA medium density screen, but WQVGA low density and WVGA high density are also considered to be normal. This attribute is "true" by default.

 

指示一个应用程序是否支持“普通”屏幕规格。传统地它是一个HVGA中等密度屏幕,但WQVGA低密度和WVGA高密度也被认为是普通的。此属性默认为"true"。

 

* android:largeScreens

 

Indicates whether the application supports larger screen form-factors. A large screen is defined as a screen that is significantly larger than a "normal" handset screen, and thus might require some special care on the application's part to make good use of it, though it may rely on resizing by the system to fill the screen.

 

指示应用程序是否支持较大屏幕规格。一个大屏幕被定义为一个明显大于“正常”手机屏幕的屏幕,因此需要关于应用程序的部分的一些特殊注意以好好地利用它,虽然它可能依赖于系统的改变大小以适应屏幕。

 

The default value for this actually varies between some versions, so it's better if you explicitly declare this attribute at all times. Beware that setting it "false" will generally enable screen compatibility mode.

 

它的默认值实际上在一些版本之间有差别,所以如果你在所有时候显式地声明此属性的话比较好。请意识到设置它为"false"将通常会使能屏幕兼容性模式。

 

* android:xlargeScreens

 

Indicates whether the application supports extra large screen form-factors. An xlarge screen is defined as a screen that is significantly larger than a "large" screen, such as a tablet (or something larger) and may require special care on the application's part to make good use of it, though it may rely on resizing by the system to fill the screen.

 

指示应用程序是否支持超大屏幕规格。超大屏幕被定义为一个明显大于一个“大”屏幕的屏幕,诸如一个平板(或一些更大的)以及可能需要关于应用程序的部分的特殊注意以好好地利用它,虽然它可能依赖于被系统改变大小以适应屏幕。

 

The default value for this actually varies between some versions, so it's better if you explicitly declare this attribute at all times. Beware that setting it "false" will generally enable screen compatibility mode.

 

它的默认值实际上在一些版本之间是有差别的,所以如果你在所有时候都显式地声明此属性就比较好了。请意识到设置它为"false"将通常使能屏幕兼容性模式。

 

This attribute was introduced in API level 9.

 

此属性在API级别9中被引入

 

* android:anyDensity

 

Indicates whether the application includes resources to accommodate any screen density.

 

指示应用程序是否包含资源以适应任意屏幕密度。

 

For applications that support Android 1.6 (API level 4) and higher, this is "true" by default and you should not set it "false" unless you're absolutely certain that it's necessary for your application to work. The only time it might be necessary to disable this is if your app directly manipulates bitmaps (see the Supporting Multiple Screens document for more information).

 

对于支持Android 1.6(API级别4)和更高的应用程序,它默认是"true"而且你不应该设置它为"false"除非你绝对肯定它是必需的以让你的应用程序工作。屏蔽它可能是必需的的唯一时候是你的应用直接操纵位图(见支持多屏幕文档以获得更多信息)。

 

* android:requiresSmallestWidthDp

 

Specifies the minimum smallestWidth required. The smallestWidth is the shortest dimension of the screen space (in dp units) that must be available to your application UI—that is, the shortest of the available screen's two dimensions. So, in order for a device to be considered compatible with your application, the device's smallestWidth must be equal to or greater than this value. (Usually, the value you supply for this is the "smallest width" that your layout supports, regardless of the screen's current orientation.)

 

指定需要的最小smallestWidth。smallestWidth是屏幕空间的最短尺寸(以dp为单位),它必须对于你的应用程序是可用的——就是说,可用屏幕的两个尺寸中的最短值。所以,为了让一个设备被认为兼容你的应用程序,设备的smallestWidth必须等于或大于这个值。(通常,你为它提供的值是你的布局支持的“最小宽度”,不管屏幕的当前方向是什么。)

 

For example, a typical handset screen has a smallestWidth of 320dp, a 7" tablet has a smallestWidth of 600dp, and a 10" tablet has a smallestWidth of 720dp. These values are generally the smallestWidth because they are the shortest dimension of the screen's available space.

 

例如,一个典型的手机屏幕拥有smallestWidth为320dp,一个7"平板拥有smallestWidth为600dp,而一个10"平板拥有为720dp。这些值通常是smallestWidth,因为它们是屏幕可用空间的最短尺寸。

 

The size against which your value is compared takes into account screen decorations and system UI. For example, if the device has some persistent UI elements on the display, the system declares the device's smallestWidth as one that is smaller than the actual screen size, accounting for these UI elements because those are screen pixels not available for your UI. Thus, the value you use should be the minimum width required by your layout, regardless of the screen's current orientation.

 

你的值被比较于的大小考虑到屏幕装饰物和系统用户界面。例如,如果设备在显示屏上有一些持久的用户界面元素,那么系统声明设备的smallestWidth为一个比实际屏幕大小要小的值,照顾到这些用户界面元素是因为那些屏幕像素对于你的用户界面来说是不可用的。这样,你使用的值应该是你的布局必需的最小宽度,不管屏幕的当前方向如何。

 

If your application properly resizes for smaller screen sizes (down to the small size or a minimum width of 320dp), you do not need to use this attribute. Otherwise, you should use a value for this attribute that matches the smallest value used by your application for the smallest screen width qualifier (sw<N>dp).

 

如果你的应用程序对于较小屏幕大小(向下到较小的大小或者最小宽度320dp)正确地改变大小,那么你不需要使用此属性。否则,你应该对此属性使用一个匹配被你的应用程序用于最小屏幕跨度修饰符(sw<N>dp)的最小值的值。

 

-------------------------------

 

Caution: The Android system does not pay attention to this attribute, so it does not affect how your application behaves at runtime. Instead, it is used to enable filtering for your application on services such as Android Market. However, Android Market currently does not support this attribute for filtering (on Android 3.2), so you should continue using the other size attributes if your application does not support small screens.

 

警告:Android系统不留意这个属性,所以它不影响你的应用程序在运行期如何行为。相反,它被用于使能在服务诸如Android市场上对你的应用程序的过滤。然而,Android市场当前不支持这个属性用于过滤(在Android 3.2上),所以你应该继续使用其它大小属性,如果你的应用程序不支持小屏幕。

 

-------------------------------

 

This attribute was introduced in API level 13.

 

这个属性在API级别13中引入。

 

* android:compatibleWidthLimitDp

 

This attribute allows you to enable screen compatibility mode as a user-optional feature by specifying the maximum "smallest screen width" for which your application is designed. If the smallest side of a device's available screen is greater than your value here, users can still install your application, but are offered to run it in screen compatibility mode. By default, screen compatibility mode is disabled and your layout is resized to fit the screen as usual, but a button is available in the system bar that allows the user to toggle screen compatibility mode on and off.

 

此属性允许你通过指定你的应用程序被设计为的最大的“最小屏幕宽度”来使能屏幕兼容性模式作为一个用户可选特性。如果设备可用屏幕的最小边大于你这里的值,那么用户仍可以安装你的应用程序,但提供给用户在屏幕兼容性模式下运行它。默认,屏幕兼容性模式被屏蔽而且通常你的布局被改变大小以适应屏幕,但在系统栏中有一个按钮是可用的,允许用户切换屏幕兼容性模式的开与关。

 

If your application is compatible with all screen sizes and its layout properly resizes, you do not need to use this attribute.

 

如果你的应用程序兼容所有屏幕大小而且它的布局正确地改变大小,那么你不需要使用此属性。

 

-------------------------------

 

Note: Currently, screen compatibility mode emulates only handset screens with a 320dp width, so screen compatibility mode is not applied if your value for android:compatibleWidthLimitDp is larger than 320.

 

注意:当前,屏幕兼容性模式只模拟带一个320dp宽度的手机屏幕,所以屏幕兼容性模式不被应用如果你给android:compatibleWidthLimitDp的值大于320。

 

-------------------------------

 

This attribute was introduced in API level 13.

 

这个属性在API级别13中被引入。

 

* android:largestWidthLimitDp

 

This attribute allows you to force-enable screen compatibility mode by specifying the maximum "smallest screen width" for which your application is designed. If the smallest side of a device's available screen is greater than your value here, the application runs in screen compatibility mode with no way for the user to disable it.

 

此属性允许你通过指定你的应用程序被设计成的最大的“最小屏幕宽度”来强制使能屏幕兼容性模式。如果设备可用屏幕的最小边大于你在这里的值,那么应用程序运行在屏幕兼容性模式而用户没有办法屏蔽它。

 

If your application is compatible with all screen sizes and its layout properly resizes, you do not need to use this attribute. Otherwise, you should first consider using the android:compatibleWidthLimitDp attribute. You should use the android:largestWidthLimitDp attribute only when your application is functionally broken when resized for larger screens and screen compatibility mode is the only way that users should use your application.

 

如果你的应用程序兼容所有屏幕大小并且它的布局正确地改变大小,那么你不需要使用此属性。否则,你应该首先考虑使用android:compatibleWidthLimitDp属性。你应该使用android:largestWidthLimitDp属性仅当你的应用程序在为较大的屏幕而被重新改变大小的时候功能上出现问题而且屏幕兼容性模式是用户可以使用你的应用程序的唯一方式的时候。

 

-------------------------------

 

Note: Currently, screen compatibility mode emulates only handset screens with a 320dp width, so screen compatibility mode is not applied if your value for android:largestWidthLimitDp is larger than 320.

 

注意:当前,屏幕兼容性模式只模拟带有320dp宽的手机屏幕,所以如果你给android:largestWidthLimitDp的值大于320,屏幕兼容性模式不被应用。

 

-------------------------------

 

This attribute was introduced in API level 13.

 

此属性在API级别13中被引入

 

* introduced in:

 

* 引入

 

API Level 4

 

API级别4

 

* see also:

 

* 另见:

 

* Supporting Multiple Screens 支持多屏幕

* DisplayMetrics

 

Except as noted, this content is licensed under Apache 2.0. For details and restrictions, see the Content License.

 

除特别说明外,本文在Apache 2.0下许可。细节和限制请参考内容许可证。

 

Android 4.0 r1 - 14 Feb 2012 21:12

 

-------------------------------

 

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

 

(此页部分内容基于Android开源项目,以及使用根据创作公共2.5来源许可证描述的条款进行修改)

 

(本人翻译质量欠佳,请以官方最新内容为准,或者参考其它翻译版本:

* ソフトウェア技術ドキュメントを勝手に翻訳

http://www.techdoctranslator.com/android

* Ley's Blog

http://leybreeze.com/blog/

* 农民伯伯

http://www.cnblogs.com/over140/

* Android中文翻译组

http://androidbox.sinaapp.com/


分享到:
评论

相关推荐

    android屏幕自适应

    - `&lt;supports-screens android:anyDensity="false"/&gt;`:表示不支持所有密度的屏幕,系统不会自动进行图片缩放。 2. **是否支持大屏幕**: - `&lt;supports-screens android:largeScreens="true"/&gt;`:表示支持大屏幕...

    android 多屏显示sample代码

    在`AndroidManifest.xml`中,可以设置应用支持的屏幕尺寸和密度,通过`&lt;supports-screens&gt;`标签。例如: ```xml &lt;supports-screens android:smallScreens="true" android:normalScreens="true" android:...

    android应用自适应多分辨率的解决方法

    在`AndroidManifest.xml`文件中,可以通过设置`&lt;supports-screens&gt;`标签来明确声明应用对不同屏幕尺寸和密度的支持。正确的配置如下: ```xml &lt;supports-screens android:largeScreens="true" android:...

    分享Android平板电脑上开发应用程序不能全屏显示的问题解决

    在XML布局文件中,如果未正确配置`&lt;supports-screens&gt;`标签,可能会导致应用在某些设备上显示不正常。例如,在问题描述中提到的代码片段中: ```xml package="myb.x2.app2" android:versionCode="1" android:...

    android分辨率适配源码+apk包

    8. **SW-NN dp最小宽度**:在AndroidManifest.xml中,可以设置`&lt;supports-screens&gt;`标签,指定应用支持的最小屏幕宽度,如`&lt;supports-screens android:smallScreens="true" android:normalScreens="true" android:...

    分辨率的解决办法

    这可以通过添加`&lt;supports-screens&gt;`标签来实现: ```xml package="com.example.myapp"&gt; android:icon="@mipmap/ic_launcher" android:label="@string/app_name"&gt; &lt;supports-screens android:...

    android问题集锦第二期

    &lt;supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true"/&gt; ``` - **引入特性节点**:指定应用所需的...

    android屏幕适配[参照].pdf

    - `&lt;supports-screens&gt;`标签:用于声明应用支持的屏幕尺寸和密度。 - `android:largeScreens`,`android:normalScreens`,`android:smallScreens`控制是否支持不同尺寸的屏幕。 - `android:anyDensity`设置为`...

    Android vs iPhone icon设计指南.doc

    3. 兼容更大尺寸的屏幕:通过设置`supports-screens`元素,系统在超出支持范围的屏幕上添加黑色背景,避免图像拉伸变形。 为了达到最佳视觉效果,设计师应为不同精度设计三套图标。以中精度HVGA屏幕为基准,高精度...

    Android 获取屏幕尺寸实例代码

    在XML布局文件的`&lt;supports-screens&gt;`标签中,我们可以设置程序对这些不同尺寸的支持。例如: ```xml &lt;supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true...

    android 平滑切换屏幕的几种方法总结

    - 在AndroidManifest.xml中使用`&lt;supports-screens&gt;`标签声明应用支持的屏幕尺寸和密度。 - 使用`sw600dp`, `sw720dp`等配置目录,为平板设备提供特定布局。 5. **响应式布局(Responsive Layout)**: - 使用...

    安卓UI布局相关-ndroid屏幕适配方案.rar

    5. 启用屏幕适应:在AndroidManifest.xml中设置`&lt;supports-screens&gt;`标签,开启对不同屏幕尺寸的支持。 6. 布局权重(layout_weight):在LinearLayout中,权重分配可以保证控件按比例填充剩余空间,适合不同屏幕...

    android分辨率问题

    3. 兼容更大尺寸屏幕:通过在AndroidManifest.xml中设置`&lt;supports-screens&gt;`元素,可以处理超出程序支持范围的屏幕,超出部分可能会显示为黑色背景。 为了实现最佳的视觉效果,设计师通常需要为高中低三种密度分别...

    Android多屏显示-StartActivity

    3. AndroidManifest.xml配置:在AndroidManifest.xml中声明Activity的屏幕兼容性,例如`&lt;supports-screens&gt;`标签可以指定应用支持的屏幕尺寸和密度。 二、StartActivity 1. Intent对象:启动Activity的核心是...

    Android多分辨率规格的界面设计

    在AndroidManifest.xml中,通过设置`&lt;supports-screens&gt;`标签,可以控制应用是否支持不同尺寸和密度的屏幕。例如,`android:xlargeScreens="true"`表示支持超大屏幕。 7. dp与sp的区分 除了dp用于图形元素,sp...

    android屏幕分辨率

    通过在AndroidManifest.xml文件中设置 `&lt;supports-screens&gt;` 标签,开发者可以指定应用支持的最小和最大屏幕尺寸及密度,确保应用只在符合条件的设备上显示。 综上所述,Android开发者需要考虑多种屏幕分辨率,...

    适配资料RES

    - **AndroidManifest.xml配置**:开发者可以通过配置`&lt;supports-screens&gt;`标签来声明应用支持的屏幕尺寸和分辨率范围。 5. **iOS的屏幕适配** - **Auto Layout**:苹果的Auto Layout系统使用约束来定义视图之间的...

Global site tag (gtag.js) - Google Analytics