【翻译】(67)uses-library元素
see
http://developer.android.com/guide/topics/manifest/uses-library-element.html
原文见
http://developer.android.com/guide/topics/manifest/uses-library-element.html
-------------------------------
<uses-library>
uses-library元素
-------------------------------
* syntax:
* 语法:
-------------------------------
<uses-library android:name="string"
android:required=["true" | "false"] />
-------------------------------
* contained in:
* 被包含在:
<application>
* description:
* 描述:
Specifies a shared library that the application must be linked against. This element tells the system to include the library's code in the class loader for the package.
指定一个应用程序必须被链接到的共享库。这个元素告诉系统要为该包在类加载器中包含那个库的代码。
All of the android packages (such as android.app, android.content, android.view, and android.widget) are in the default library that all applications are automatically linked against. However, some packages (such as maps) are in separate libraries that are not automatically linked. Consult the documentation for the packages you're using to determine which library contains the package code.
所有android包(诸如android.app,android.content,android.view,和android.widget)是在默认的库中,所有应用程序都会自动地链接到它。然而,一些包(诸如maps)是在单独的库中不被自动地链接。参考你正在使用的包的文档以决定哪个库包含该包的代码。
This element also affects the installation of the application on a particular device and the availability of the application in Android Market:
此元素还影响应用程序在一个特定设备上的安装以及Android市场里应用程序的可用性。
Installation
安装
If this element is present and its android:required attribute is set to true, the PackageManager framework won't let the user install the application unless the library is present on the user's device.
如果这个元素存在并且它的android:required属性被设置为true,那么PackageManager框架将不让用户安装应用程序,除非库存在于用户的设备上。
Market
市场
Android Market filters applications based on the libraries installed on the user's device. For more information about filtering, see the topic Market Filters.
Android市场基于安装在用户的设备上的库来过滤应用程序。想获得关于过滤的更多信息,参见主题市场过滤器。
The android:required attribute is described in detail in the following section.
android:required属性在以下章节中被详细地描述。
* attributes:
* 属性:
* android:name
The name of the library. The name is provided by the documentation for the package you are using. An example of this is "android.test.runner", a package that contains Android test classes.
库的名称。该名称由你正在使用的包的文档来提供。它的一个示例是"android.test.runner",一个包含Android测试类的包。
* android:required
Boolean value that indicates whether the application requires the library specified by android:name:
布尔值,指示应用程序是否必需被android:name指定的库:
* "true": The application does not function without this library. The system will not allow the application on a device that does not have the library.
* "true":应用程序在没有这个库的情况下不起作用。系统将不允许在一个没有该库的设备上存在这个应用程序。
* "false": The application can use the library if present, but is designed to function without it if necessary. The system will allow the application to be installed, even if the library is not present. If you use "false", you are responsible for checking at runtime that the library is available.
* "false":应用程序可以使用该库,如果存在的话,但被设计为在没有它的情况下起作用,如果有必要的话。系统将允许应用程序被安装,即便库不存在。如果你使用"false",那么你有责任在运行时检查该库是可用的。
To check for a library, you can use reflection to determine if a particular class is available.
为了检查一个库,你可以使用反射以确定一个特定的类是否可用。
The default is "true".
默认为"true"。
Introduced in: API Level 7.
引入:API级别7。
* introduced in:
* 引入:
API Level 1
API级别1
* see also:
* 另见:
* PackageManager
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/
)