`

【翻译】(48)application元素

 
阅读更多

【翻译】(48)application元素

 

see

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

 

原文见

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

 

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

 

<application>

 

application元素

 

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

 

* syntax:

 

* 语法:

 

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

 

<application android:allowTaskReparenting=["true" | "false"]

             android:backupAgent="string"

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

             android:description="string resource"

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

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

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

             android:icon="drawable resource"

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

             android:label="string resource"

             android:logo="drawable resource"

             android:manageSpaceActivity="string"

             android:name="string"

             android:permission="string"

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

             android:process="string"

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

             android:taskAffinity="string"

             android:theme="resource or theme"

             android:uiOptions=["none" | "splitActionBarWhenNarrow"] >

    . . .

</application>

 

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

 

* contained in:

 

* 被包含在:

 

<manifest>

 

* can contain:

 

* 可以包含:

 

<activity> 

<activity-alias> 

<service> 

<receiver> 

<provider> 

<uses-library>

 

* description:

 

* 描述:

 

The declaration of the application. This element contains subelements that declare each of the application's components and has attributes that can affect all the components. Many of these attributes (such as icon, label, permission, process, taskAffinity, and allowTaskReparenting) set default values for corresponding attributes of the component elements. Others (such as debuggable, enabled, description, and allowClearUserData) set values for the application as a whole and cannot be overridden by the components.

 

应用程序的声明。这个元素包含声明应用程序每个组件的子元素以及拥有可以影响所有组件的属性。许多这些属性(诸如icon,label,permission,process,taskAffinity,和allowTaskReparenting)设置组件元素的相应属性的默认值。其它属性(诸如debuggable,enabled,description,和allowClearUserData)设置用于应用程序整体的值并且不能被组件覆盖。

 

* attributes

 

* 属性

 

* android:allowTaskReparenting

 

Whether or not activities that the application defines can move from the task that started them to the task they have an affinity for when that task is next brought to the front — "true" if they can move, and "false" if they must remain with the task where they started. The default value is "false".

 

应用程序定义的活动是否可以从启动它们的任务中移动到它们拥有关系的任务中,当那个任务接下来被带到前方时——"true"如果它们可以移动,而"false"如果它们必须从属于它们启动所在的任务。默认值为"false"。

 

The <activity> element has its own allowTaskReparenting attribute that can override the value set here. See that attribute for more information.

 

<activity>元素拥有它自己的allowTaskReparenting属性,它可以覆盖这里设置的值。见那个属性以获得更多信息。

 

* android:backupAgent

 

The name of the class that implement's the application's backup agent, a subclass of BackupAgent. The attribute value should be a fully qualified class name (such as, "com.example.project.MyBackupAgent"). However, as a shorthand, if the first character of the name is a period (for example, ".MyBackupAgent"), it is appended to the package name specified in the <manifest> element.

 

实现(注:这里's貌似应该是s)应用程序备份代理的类的名称,BackupAgent的一个子类。属性值应该是一个完全修饰类名(诸如,"com.example.project.MyBackupAgent")。然而,作为简写,如果第一个字符的名称是一个点(例如,".MyBackupAgent"),那么它被尾加到<manifest>元素中指定的包名后面。

 

There is no default. The name must be specified.

 

没有默认值。这个值必须被指定。

 

* android:debuggable

 

Whether or not the application can be debugged, even when running on a device in user mode — "true" if it can be, and "false" if not. The default value is "false".

 

应用程序是否可以被调试,即使当运行在用户模式中的设备上的时候——"true"如果它可以,而"false"如果它不可以。默认值为"false"。

 

* android:description

 

User-readable text about the application, longer and more descriptive than the application label. The value must be set as a reference to a string resource. Unlike the label, it cannot be a raw string. There is no default value.

 

关于应用程序的用户可读文本,比应用程序标签更长和更多描述。这个值必须被设置为一个指向字符串资源的引用。不像标签那样,它不可以是一个原始字符串。没有默认值。

 

* android:enabled

 

Whether or not the Android system can instantiate components of the application — "true" if it can, and "false" if not. If the value is "true", each component's enabled attribute determines whether that component is enabled or not. If the value is "false", it overrides the component-specific values; all components are disabled.

 

Android系统是否可以实例化这个应用程序的组件——"true"如果它可以,而"false"如果它不能。如果值为"true",那么每个组件的enabled属性决定哪个组件是否使能。如果值是"false",那么它覆盖组件特定的值;所有组件被屏蔽。

 

The default value is "true".

 

默认值为"true"。

 

* android:hasCode

 

Whether or not the application contains any code — "true" if it does, and "false" if not. When the value is "false", the system does not try to load any application code when launching components. The default value is "true".

 

应用程序是否包含任意代码——"true"如果它包含,而"false"如果它不包含。当该值是"false",系统在启动组件时不尝试加载任意应用程序代码。默认值为"true"。

 

An application would not have any code of its own only if it's using nothing but built-in component classes, such as an activity that uses the AliasActivity class, a rare occurrence.

 

一个应用程序将不拥有它自己的任何代码仅当它正在只使用内建组件类,诸如一个使用AliasActivity类的活动,很少会出现。

 

* android:hardwareAccelerated

 

Whether or not hardware-accelerated rendering should be enabled for all Activities and Views in this application — "true" if it should be enabled, and "false" if not. The default value is "false".

 

硬件加速的渲染器是否应该为这个应用程序中的所有Activity和View而使能——"true"如果它应该被使能,而"false"如果它不应该。默认值为"false"。

 

Starting from Android 3.0, a hardware-accelerated OpenGL renderer is available to applications, to improve performance for many common 2D graphics operations. When the hardware-accelerated renderer is enabled, most operations in Canvas, Paint, Xfermode, ColorFilter, Shader, and Camera are accelerated. This results in smoother animations, smoother scrolling, and improved responsiveness overall, even for applications that do not explicitly make use the framework's OpenGL libraries.

 

从Android 3.0开始,一个硬件加速的OpenGL渲染器对于应用程序可用,以提高许多通用二维图形操作的性能。当硬件加速渲染器被使能时,在Canvas,Paint,Xfermode,ColorFilter,Shader,和Camera中的大多数操作被加速。它导致更平滑的动画,更平滑的滚动,以及全面提高的响应性,甚至对于没有显式使用框架的OpenGL库的应用程序。

 

Note that not all of the OpenGL 2D operations are accelerated. If you enable the hardware-accelerated renderer, test your application to ensure that it can make use of the renderer without errors.

 

注意不是所有OpenGL二维操作被加速。如果你使能硬件加速渲染器,请测试你的应用程序以确保它可以不带错误地使用渲染器。

 

* android:icon

 

An icon for the application as whole, and the default icon for each of the application's components. See the individual icon attributes for <activity>, <activity-alias>, <service>, <receiver>, and <provider> elements.

 

用于整体应用程序的一个图标,以及用于每个应用程序组件的默认图标。见<activity>,<activity-alias>,<service>,<receiver>,和<provider>元素的单独的icon属性。

 

This attribute must be set as a reference to a drawable resource containing the image (for example "@drawable/icon"). There is no default icon.

 

这个属性必须被设置为指向包含图片的可绘画对象资源的一个引用(例如"@drawable/icon")。没有默认图标。

 

* android:killAfterRestore

 

Whether the application in question should be terminated after its settings have been restored during a full-system restore operation. Single-package restore operations will never cause the application to be shut down. Full-system restore operations typically only occur once, when the phone is first set up. Third-party applications will not normally need to use this attribute.

 

有问题的应用程序是否被终止,在一个完全系统还原操作期间它的设置已经被还原之后。单一包的还原操作将从不导致应用程序被关闭。当电话第一次被配置时,完全系统还原操作通常只发生一次。第三方应用程序通常不需要使用这个属性。

 

The default is true, which means that after the application has finished processing its data during a full-system restore, it will be terminated.

 

默认值为true,它意味着完全系统还原期间在应用程序已经完成处理它的数据之后,它将被终止。

 

* android:label

 

A user-readable label for the application as a whole, and a default label for each of the application's components. See the individual label attributes for <activity>, <activity-alias>, <service>, <receiver>, and <provider> elements.

 

用于应用程序整体的一个用户可读标签,以及用于每个应用程序组件的默认标签。请参见<activity>,<activity-alias>,<service>,<receiver>,和<provider>元素的单独的label属性

 

The label should be set as a reference to a string resource, so that it can be localized like other strings in the user interface. However, as a convenience while you're developing the application, it can also be set as a raw string.

 

这个标签应该被设置为指向字符串资源的一个引用,以使它可以像用户界面中其它字符串那样被本地化。然而,当你正在开发应用程序时为了方便,它也可以被设置为一个原始字符串。

 

* android:logo

 

A logo for the application as whole, and the default logo for activities.

 

用于应用程序整体的一个徽记,以及用于活动的默认徽记。

 

This attribute must be set as a reference to a drawable resource containing the image (for example "@drawable/logo"). There is no default logo.

 

这个属性必须被设置为一个指向一个包含图片的可绘画对象资源的引用(例如"@drawable/logo")。没有默认徽记。

 

* android:manageSpaceActivity

 

The fully qualified name of an Activity subclass that the system can launch to let users manage the memory occupied by the application on the device. The activity should also be declared with an <activity> element.

 

一个Activity子类的完全修饰名称,系统可以启动它以让用户管理在设备上被应用程序占据的内存。该活动也应该用一个<activity>元素来声明。

 

* android:name

 

The fully qualified name of an Application subclass implemented for the application. When the application process is started, this class is instantiated before any of the application's components.

 

一个Application子类的完全限定名称,它为应用程序而实现。当应用程序进程被启动时,这个类在任意应用程序组件之前被实例化。

 

The subclass is optional; most applications won't need one. In the absence of a subclass, Android uses an instance of the base Application class.

 

该子类是可选的;大多数应用程序不需要它。在缺少子类的时候,Android使用Application基类的一个实例。

 

* android:permission

 

The name of a permission that clients must have in order to interact with the application. This attribute is a convenient way to set a permission that applies to all of the application's components. It can be overwritten by setting the permission attributes of individual components.

 

权限的名称,客户端必须拥有那个权限以便与应用程序交互。这个属性是设置应用到所有应用程序组件的权限的便利方法。它可以通过设置个别组件的permission属性来覆盖。

 

For more information on permissions, see the Permissions section in the introduction and another document, Security and Permissions.

 

想获得关于权限的更多信息,请参见介绍中的权限章节以及另一个文档,安全与权限。

 

* android:persistent

 

Whether or not the application should remain running at all times — "true" if it should, and "false" if not. The default value is "false". Applications should not normally set this flag; persistence mode is intended only for certain system applications.

 

应用程序是否应该在所有时候保持运行——"true"如果它应该,而"false"如果它不应该。默认值为"false"。应用程序正常情况下不应该设置这个标志;持久模式只倾向用于某些系统应用程序。

 

* android:process

 

The name of a process where all components of the application should run. Each component can override this default by setting its own process attribute.

 

所有应用程序组件应该运行在的进程的名称。每个组件可以通过设置它自己的process属性来覆盖这个默认值。

 

By default, Android creates a process for an application when the first of its components needs to run. All components then run in that process. The name of the default process matches the package name set by the <manifest> element.

 

默认,当一个应用程序的第一个组件需要运行时,Android为它创建一个进程。然后所有组件运行在那个进程中。默认进程的名称匹配由<manifest>元素设置的包名。

 

By setting this attribute to a process name that's shared with another application, you can arrange for components of both applications to run in the same process — but only if the two applications also share a user ID and be signed with the same certificate.

 

通过设置这个属性为与另一个应用程序共享的一个进程名称,你可以安排两个应用程序的组件运行在同一个进程中——但仅当两个应用程序还共享一个用户ID并且用相同的证书签名。

 

If the name assigned to this attribute begins with a colon (':'), a new process, private to the application, is created when it's needed. If the process name begins with a lowercase character, a global process of that name is created. A global process can be shared with other applications, reducing resource usage.

 

如果赋予这个属性的名称以一个冒号(':')开头,那么一个对于应用程序是私有的新进程在需要它的时候被创建。如果进程名称以一个小写字符开头,那么那个名称的一个全局进程被创建。一个全局进程可以和其它应用程序共享,降低资源使用率。

 

* android:restoreAnyVersion

 

Indicate that the application is prepared to attempt a restore of any backed-up data set, even if the backup was stored by a newer version of the application than is currently installed on the device. Setting this attribute to true will permit the Backup Manager to attempt restore even when a version mismatch suggests that the data are incompatible. Use with caution!

 

指示应用程序准备好尝试任意备份数据集的还原,即便备份是由一个比当前安装在设备上的更新版本的应用程序存储的。设置这个属性为true将允许备份管理器尝试还原,即使当版本的不匹配暗示数据是不兼容的。请谨慎使用!

 

The default value of this attribute is false.

 

这个属性的默认值为false。

 

* android:taskAffinity

 

An affinity name that applies to all activities within the application, except for those that set a different affinity with their own taskAffinity attributes. See that attribute for more information.

 

应用到应用程序中所有活动的一个关系名称,除了那些用它们自己的taskAffinity属性设置一个不同关系的活动。见那个属性以获得更多信息。

 

By default, all activities within an application share the same affinity. The name of that affinity is the same as the package name set by the <manifest> element.

 

默认,一个应用程序中的所有活动共享相同的关系。关系的名称与<manifest>元素设置的包名相同。

 

* android:theme

 

A reference to a style resource defining a default theme for all activities in the application. Individual activities can override the default by setting their own theme attributes. For more information, see the Styles and Themes developer guide.

 

指向一个为应用程序中的所有活动定义默认主题的样式资源的一个引用。个别活动可以通过设置它们自己的theme属性来覆盖这个默认值。想获得更多信息,请参见样式与主题开发者指引。

 

* android:uiOptions

 

Extra options for an activity's UI.

 

关于一个活动的用户界面的额外选项。

 

Must be one of the following values.

 

必须是以下值之一。

 

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

 

* Value Description

 

* 值 描述

 

* "none" No extra UI options. This is the default.

 

* "none" 没有额外的用户界面选项。它是默认值。

 

* "splitActionBarWhenNarrow" Add a bar at the bottom of the screen to display action items in the ActionBar, when constrained for horizontal space (such as when in portrait mode on a handset). Instead of a small number of action items appearing in the action bar at the top of the screen, the action bar is split into the top navigation section and the bottom bar for action items. This ensures a reasonable amount of space is made available not only for the action items, but also for navigation and title elements at the top. Menu items are not split across the two bars; they always appear together.

 

* "splitActionBarWhenNarrow" 添加一个栏在屏幕的底部以显示ActionBar中的动作条目,当它被水平方向上的空间约束时(诸如当处于手机上的竖屏模式时)。不是小数量的动作条目显示在屏幕顶部的动作栏中,取而代之动作栏被分割成顶部的导航部分以及用于动作条目的底栏。它确保使合理数量的空间可用,不仅仅为了动作条目,还为了顶部的导航和标题元素。菜单条目不会跨两个栏被分割;它们总是一起出现。

 

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

 

For more information about the action bar, see the Action Bar developer guide.

 

想获取关于动作栏的更多信息,请参见动作栏开发者指引。

 

This attribute was added in API level 14.

 

这个属性在API级别14中添加。

 

* introduced in:

 

* 引入:

 

API Level 1

 

API级别1

 

* see also:

 

* 另见:

 

<activity> 

<service> 

<receiver> 

<provider>

 

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/


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics