【翻译】(50)compatible-screens元素
see
http://developer.android.com/guide/topics/manifest/compatible-screens-element.html
原文见
http://developer.android.com/guide/topics/manifest/compatible-screens-element.html
-------------------------------
<compatible-screens>
compatible-screens元素
-------------------------------
* syntax:
* 语法:
-------------------------------
<compatible-screens>
<screen android:screenSize=["small" | "normal" | "large" | "xlarge"]
android:screenDensity=["ldpi" | "mdpi" | "hdpi" | "xhdpi"] />
...
</compatible-screens>
-------------------------------
* contained in:
* 被包含在:
<manifest>
* description:
* 描述:
Specifies each screen configuration with which the application is compatible. Only one instance of the <compatible-screens> element is allowed in the manifest, but it can contain multiple <screen> elements. Each <screen> element specifies a specific screen size-density combination with which the application is compatible.
指定应用程序兼容的每个屏幕属性。在清单中只允许有一个<compatible-screens>元素的实例,但它可以包含多个<screen>元素。每个<screen>元素指定该应用程序兼容的一种特定的屏幕大小-密度组合。
The Android system does not read the <compatible-screens> manifest element (neither at install-time nor at runtime). This element is informational only and may be used by external services (such as Android Market) to better understand the application's compatibility with specific screen configurations and enable filtering for users. Any screen configuration that is not declared in this element is a screen with which the application is not compatible. Thus, external services (such as Android Market) should not provide the application to devices with such screens.
Android系统不会读取<compatible-screens>清单元素(也不会在安装期或运行期读取)。这个元素只是信息,而且可能被外部服务使用(诸如Android市场)以更好地理解应用程序对特定屏幕配置的兼容性和为用户使能过滤。在这个元素中没有声明的任意屏幕配置是该应用程序不兼容的一种屏幕。因此,外部服务(诸如Android市场)不应该提供该应用程序给带有这些屏幕的设备。
-------------------------------
Caution: Normally, you should not use this manifest element. Using this element can dramatically reduce the potential user base for your application, by not allowing users to install your application if they have a device with a screen configuration that you have not listed. You should use it only as a last resort, when the application absolutely does not work with all screen configurations. Instead of using this element, you should follow the guide to Supporting Multiple Screens, in order to provide complete support for multiple screens, by adding alternative resources for different screen sizes and densities.
警告:通常,你不应该使用这个清单元素。使用这个元素可以显著地降低你的应用程序的潜在用户基线,通过不允许用户安装你的应用程序如果他们拥有一个带有你不曾列举的屏幕配置的设备。你应该只使用它作为最后的手段,当应用程序绝对不能与所有屏幕配置一起工作时。不是使用这个元素,你而是应该遵循指引支持多屏幕,以便提供对多屏幕的完整支持,通过添加用于不同屏幕大小和密度的可选资源来做到。
-------------------------------
If you want to set only a minimum screen size for your your application, then you should use the <supports-screens> element. For example, if you want your application to be available only for large and xlarge screen devices, the <supports-screens> element allows you to declare that your application does not support small and normal screen sizes. External services (such as Android Market) will filter your application accordingly. You can also use the <supports-screens> element to declare whether the system should resize your application for different screen sizes.
如果你只是希望为你的应用程序设置一个最小屏幕大小,那么你应该使用<supports-screens>元素。例如,如果你希望你的应用程序只对大和超大屏幕设备可用,那么<supports-screens>元素允许你声明你的应用程序不支持小和普通屏幕大小。外部服务(诸如Android市场)将据此过滤你的应用程序。你还可以使用<supports-screens>元素来声明系统是否应该为不同的屏幕大小重新改变你的应用程序的大小。
Also see the Market Filters document for more information about how Android Market filters applications using this and other manifest elements.
另见市场过滤器文档以获得关于Android市场过滤器应用程序如何使用这个和其它清单元素的更多信息。
* child elements:
* 子元素:
* <screen>
Specifies a single screen configuration with which the application is compatible.
指定该应用程序兼容的单一屏幕配置。
At least one instance of this element must be placed inside the <compatible-screens> element. This element must include both the android:screenSize and android:screenDensity attributes (if you do not declare both attributes, then the element is ignored).
这个元素至少有一个实例必须放在<compatible-screens>元素内。这个元素必须都包含android:screenSize和android:screenDensity属性(如果你不同时声明这两个属性,那么该元素被忽略)。
* attributes:
* 属性:
* android:screenSize
Required. Specifies the screen size for this screen configuration.
必需的。为这个屏幕配置指定屏幕大小。
Accepted values:
接受的值
* small
* normal
* large
* xlarge
For information about the different screen sizes, see Supporting Multiple Screens.
想获得关于不同屏幕大小的信息,参见支持多屏幕。
* android:screenDensity
Required. Specifies the screen density for this screen configuration.
必需的。指定用于这个屏幕配置的屏幕密度。
Accepted values:
接受的值:
* ldpi
* mdpi
* hdpi
* xhdpi
For information about the different screen densities, see Supporting Multiple Screens.
想获得关于不同屏幕密度的信息,参见支持多屏幕。
* example
* 示例
If your application is compatible with only small and normal screens, regardless of screen density, then you must specify eight different <screen> elements, because each screen size has four different density configurations. You must declare each one of these; any combination of size and density that you do not specify is considered a screen configuration with which your application is not compatible. Here's what the manifest entry looks like if your application is compatible with only small and normal screens:
如果你的应用程序只兼容小和普通屏幕,不管屏幕密度如何,那么你必须指定不同的<screen>元素之一,因为每个屏幕大小拥有四种不同的密度配置。你必须声明它们之中的一个;你没有指定的大小和密度的任意组合被认为是你的应用程序不兼容的屏幕配置。这里是清单条目看起来的样子,如果你的应用程序只兼容小和普通屏幕:
-------------------------------
<manifest ... >
...
<compatible-screens>
<!-- all small size screens -->
<!-- 所有小尺寸的屏幕 -->
<screen android:screenSize="small" android:screenDensity="ldpi" />
<screen android:screenSize="small" android:screenDensity="mdpi" />
<screen android:screenSize="small" android:screenDensity="hdpi" />
<screen android:screenSize="small" android:screenDensity="xhdpi" />
<!-- all normal size screens -->
<!-- 所有普通大小的屏幕 -->
<screen android:screenSize="normal" android:screenDensity="ldpi" />
<screen android:screenSize="normal" android:screenDensity="mdpi" />
<screen android:screenSize="normal" android:screenDensity="hdpi" />
<screen android:screenSize="normal" android:screenDensity="xhdpi" />
</compatible-screens>
<application ... >
...
<application>
</manifest>
-------------------------------
* introduced in:
* 引入:
API Level 9
API级别9
* see also:
* 另见:
Supporting Multiple Screens
支持多屏幕
Market Filters
市场过滤器
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 - 10 Feb 2012 0:44
-------------------------------
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/
)