首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > XML SOAP >

AndroidManifest.xml解析(较比详细)

2012-09-07 
AndroidManifest.xml解析(较详细)Android学习笔记 3:AndroidManifest.xml - application 翻译中applicati

AndroidManifest.xml解析(较详细)
Android学习笔记 3:AndroidManifest.xml - application 翻译中
<application>

syntax:语法:

    <application android:allowClearUserData=["true" | "false"]
                 android:allowTaskReparenting=["true" | "false"]
                 android:debuggable=["true" | "false"]
                 android:description="string resource"
                 android:enabled=["true" | "false"]
                 android:hasCode=["true" | "false"]
                 android:icon="drawable resource"
                 android:label="string resource"
                 android:manageSpaceActivity="string"
                 android:name="string"
                 android:permission="string"
                 android:persistent=["true" | "false"]
                 android:process="string"
                 android:taskAffinity="string"
                 android:theme="resource or theme" >
        . . .
    </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.
    应用程序的声明。本元素包含子元素,即每个应用程序组件的声明,而且应用程序的属性能够影响所有组件。许多这样的属性(比如图标,标签,许可,进程,taskAffinity,和allowTaskReparenting) 设置默认值给组件元素的对应属性。其他的(比如debuggable,enabled,description 和allowClearUserData)设置全局值给应用程序,并不会被组件覆盖。

attributes 属性:

    android:allowClearUserData
        Whether or not users are given the option to remove user data — "true" if they are, and "false" if not. If the value is "true", as it is by default, the application manager includes an option that allows users to clear the data.
        用户是否被给予移除用户数据的选择 — "true"表示有,"false"表示没有。如果值是"true",也是默认值,应用程序管理器包含一个选择允许用户清除数据。

    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".
        应用程序里定义的activity是否,在与它有affinity的task被带到前台时能够从启动时的task移动过去 — "true" 表示可以,"false"表示它必须留在启动它们的task里。默认值是"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: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属性决定那个组件是否可以被 enabled。如果值是"false",它覆盖组件指定的值;所有组件都是disabled。

        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".
        应用程序是否含有任何code — "true"表示有,"false"表示没有。当值是"false",当载入组件时,系统不会试图载入任何应用程序code。默认值是"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.
        一个应用程序一般没有它自己的任何code,除非它仅由组件类构建而成,比如一个activity使用AliasActivity类,这是很少发生的。
    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>元素各自的图标属性。

        This attribute must be set as a reference to a drawable resource containing the image definition. There is no default icon.
        本属性必须设置一个对drawable资源的参照,包含图像定义。图标没有默认值。
    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>元素各自的标签属性。

        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: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也应该用<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.
        客户端与应用程序交互所必须拥有的许可名。本属性是一个给应用程序的所有组件设置许可的便捷方式。它可以被组件各自的许可属性的值所覆盖。

        For more information on permissions, see the Permissions section in the introduction and another document, Security and Permissions.
        关于许可的更多信息,参照导言的Permissions章节以及另外的文档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.
        应用程序的所有组件应该运行的进程名。每个组件能够设置自己的进程属性以覆盖本默认值。

        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: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.
        应用程序里所有activity都适用的affinity名,除了那些设置了不同的affinity在它们自己的taskAffinity属性里activity。更多信息参照那个属性。

        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.
        默认的,应用程序里的所有activity分享同一个affinity。该affinity名与设置在<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; see that attribute for more information.
        一个风格资源的参照,它定义了一个默认的主题给应用程序里的所有activity。各个activity可以通过在它们自己的theme属性里设置值来覆盖它;更多信息请参照那个属性。

introduced in:介绍:
    API Level 1

see also:
    <activity>
    <service>
    <receiver>
    <provider>

热点排行