首页 > 移动平台 > 详细

android <application> 开发文档翻译

时间:2014-05-25 09:05:12      阅读:490      评论:0      收藏:0      [点我收藏+]

由于本人英文能力实在有限,不足之初敬请谅解

本博客只要没有注明“转”,那么均为原创,转贴请注明本博客链接链接


<application>
语法:
    <application android:allowTaskReparenting=["true" | "false"]
                 android:allowBackup=["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:largeHeap=["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:requiredAccountType="string"
                 android:restrictedAccountType="string"
                 android:supportsRtl=["true" | "false"]
                 android:taskAffinity="string"
                 android:testOnly=["true" | "false"]
                 android:theme="resource or theme"
                 android:uiOptions=["none" | "splitActionBarWhenNarrow"]
                 android:vmSafeMode=["true" | "false"] >
        . . .
    </application>

包含在:
    <manifest>

可以包含:
    <activity>
    <activity-alias>
    <meta-data>
    <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".

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

    android:allowTaskReparenting
        无论application定义的activity是否可以从启动他们的task移动到即将来到前台并带有相同Affinity的task中去 - “true”表示可以移动,“false”表示它必须停留在启动它的task中。默认值为false。

        <activity>元素有其自己的allowTaskReparenting属性,并且可以覆盖这里设置的值。更多信息参见<activity>的属性

    android:allowbackup
        Whether to allow the application to participate in the backup and restore infrastructure. If this attribute is set to false, no backup or restore of the application will ever be performed, even by a full-system backup that would otherwise cause all application data to be saved via adb. The default value of this attribute is true.

    android:allowbackup
        是否允许应用参与备份与恢复。如果这个属性为false,即使是在整个系统的备份中,应用也不会被备份或恢复,否则所有应用数据都会通过adb保存下来。此属性的默认值是true。


    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.

        There is no default. The name must be specified.

    android:backupAgent
        实现应用的备份代理的类的名字,BackupAgent的一个子类。属性值应该是一个全限定类名(例如,"com.example.project.MyBackupAgent")。然而,如果名字的第一个字符是点的话可以作为简写(例如,".MyBackupAgent"),它追加在<manifest>元素中指定的包名后面。

        这个属性没有默认值。必须指定类名才行。

    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".

    android:debuggable
        应用运行在user模式下的设备上是否可以被debug - 如果可以被debug,则设置为“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:description
        用户可读的介绍应用的文本,比应用的label更长更详细。这个值必须是引用一个string资源。与label不用,这个值不可以在这里直接赋值。它没有默认值。


    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.

        The default value is "true".

    android:enabled
        Android系统是否可以实例化应用的组件 - “true”则可以,“false”则不可以。如果这个值为true,每一个组件的enabled属性决定着自己是否是enabled。如果这个值为false,它会覆盖组件指定的值,所有组件将都为disabled

        默认值为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".

        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.

    android:hasCode
        应用是否包含代码 - true则包含,false则不包含。当属性值为false的时候,当启动组件的时候,系统不会尝试加载应用的任何代码。默认值为true

        应用只有在它使用内建组件类的时候才会含有代码,比如使用AliasActivity类的activity,这是一个比较罕见的情况。



    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 "true" if you‘ve set either minSdkVersion or targetSdkVersion to "14" or higher; otherwise, it‘s "false".

        Starting from Android 3.0 (API level 11), 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.

        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.

        For more information, read the Hardware Acceleration guide.

    android:hardwareAccelerate
        应用中,硬件加速渲染是否对所有的activity和view都启动 - true则启用,false则关闭。如果minSdkVersion或targetSdkVersion设置为14或14以上,则默认值为true,否则这个值为false

        从android3.0(Api level 11)开始,应用可以使用硬件加速的OpenGL渲染器来改进很多常规2D图形操作的性能。当硬件加速渲染器启用时,大多数Canvas, Paint, Xfermode, ColorFilter, Shader, 和 Camera中的操作都是被加了速的。这会得到更流畅的动画、滚动,提升整体的响应性,甚至是没有显式使用framework的OpenGL库的应用。

        注意,并不是所有的OpenGL 2D操作都是被加速的。如果你启用硬件加速渲染器,测试你的应用保证正确使用加速器。

        更多信息,请阅读硬件加速向导。


    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.

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

    android:icon
        应用的全局图标,也是应用每个组件的默认图标。参见<activity>, <activity-alias>, <service>, <receiver>, 和 <provider>元素的独立的图标属性。

        这个属性必须设置为是引用一个包含图片的drawable资源(例如 "@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.

    android:killAfterRestore
        在整个系统恢复期间,应用在其设置被恢复之后是否应该被终止。单独一个包的恢复操作绝不会导致应用被关闭。整个系统恢复的操作往往只会发生一次,就是当手机第一次设置的时候。第三方应用一般不需要使用这个属性。

        这个属性的默认值为true,也就是说,在整个系统恢复期间,这个应用在完成处理它自己的数据之后,它将被终止。


    android:largeHeap
        Whether your application‘s processes should be created with a large Dalvik heap. This applies to all processes created for the application. It only applies to the first application loaded into a process; if you‘re using a shared user ID to allow multiple applications to use a process, they all must use this option consistently or they will have unpredictable results.

        Most apps should not need this and should instead focus on reducing their overall memory usage for improved performance. Enabling this also does not guarantee a fixed increase in available memory, because some devices are constrained by their total available memory.

        To query the available memory size at runtime, use the methods getMemoryClass() or getLargeMemoryClass().

    android:largeHeap
        你应用的进程是否可以使用一个较大的Dalvik堆。这适用于应用创建的所有进程。它只适用于加载到进程中的第一个应用;如果你使用shared user ID让多个应用使用同一个进程,这些应用必须都使用合格选项,否则将会导致他们有不可预期的结果。

        大多数app应该不需要设置这个属性,应该把注意力放在减少整体内存的使用来改进性能。因为一些设备受总的可用内存限制,所以开启这个属性也不会保证可用内存会增加。

        使用getMemoryClass()或getLargeMemoryClass()可以在运行时查询可用内存大小。


    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.

        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:label
        整个应用的一个可被用户读取的标签,也是应用中每个组件的默认标签。见<activity>, <activity-alias>, <service>, <receiver>, 和 <provider>元素独立的标签属性。

        标签应该是引用一个字符串资源,以便可以像UI中其他字符串一样被国际化。然而,当你开发应用的时候为了方便,它也可以使用原始字符串。


    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.

    android:logo
        应用的全局标致,也是activity的默认标致。

        这个属性必须设置为一个包含图片的drawable资源(例如 "@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.

    android:manageSpaceActivity
        系统可以启动的让用户管理应用在设备上占用内存的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.

        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:name
        应用的一个实现application的子类全限定名。当应用进程开启的时候,这个类在应用的任何组件之前被实例化。

        这个子类是可选的;大多数应用不需要这个。没有这个子类的时候,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.

    android:permission
        客户端必须有的,用来与之交互的权限的名字。这个属性给使用所有应用的组件设置权限是很方便的。为独立的组件设置权限属性可以重新它。

        关于权限的更多信息,参看介绍中的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.

    android:persistent
        应用是否应该一直持续运行 - true则应该,false则不该。默认值为false。应用正常来说不应该设置这个标识,persistence模式本意只是为某个系统应用而设计的。


    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.

        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.

        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:process
        应用所有组件应该运行其中的进程的名字。每个组件都可以使用它自己的进程属性覆盖这个默认值。

        默认的,当应用组件中第一个需要运行的时候,android为应用创建进程。所有组件则都运行在这个进程中。默认进程的名字与<manifest>元素中设置的包名一致。

        通过设置这个属性来指定一个进程名来与另一个应用共用进程,你可以让两个应用的组件运行在用一个进程中 - 但是只能是两个应用也共享一个user ID并且具有相同的签名才行。

        如果这个属性值是以冒号(‘:‘)开头,当需要的时候,一个新的,应用的私有进程会被创建。如果进程名以小写字符开始,以这个名字命名的全局进程会被创建。全局进程可以与其他应用共用,减少资源的使用。


    android:restoreAnyVersion
        Indicates 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!

        The default value of this attribute is false.

    android:restoreAnyVersion
        表明应用准备好试图恢复任何一个备份数据集,即使这个备份是由一个比当前安装在设备上更新的版本创建的。设置这个属性为true则允许Backup Manager尝试恢复,即使是当由于版本不匹配而可能导致数据不兼容的时候。慎重使用这个属性!

        这个属性的默认值是false。


    android:requiredAccountType
        Specifies the account type required by the application in order to function. If your app requires an Account, the value for this attribute must correspond to the account authenticator type used by your app (as defined by AuthenticatorDescription), such as "com.google".

        The default value is null and indicates that the application can work without any accounts.

        Because restricted profiles currently cannot add accounts, specifying this attribute makes your app unavailable from a restricted profile unless you also declare android:restrictedAccountType with the same value.

        Caution: If the account data may reveal personally identifiable information, it‘s important that you declare this attribute and leave android:restrictedAccountType null, so that restricted profiles cannot use your app to access personal information that belongs to the owner user.

        This attribute was added in API level 18.

    android:requiredAccountType
        指定应用所要求的账户类型以便运行应用。如果你的app需要一个账户,这个属性值必须与你的应用account authenticator类型一致(与通过AuthenticatorDescription定定义的一致),例如 "com.google"。

        这个默认值为null,表明应用可以在没有任何账户的情况下工作。

        因为“受限个人资料”目前无法添加账户,指定这个属性,你的应用将无法使用“受限个人资料”,除非你设置android:restrictedAccountType为同样的值。

        警告:如果账户数据可能会展现个人身份信息,声明这个属性并把它设置为null则是很重要的。这样“受限个人资料”就不能使用你的应用访问属于用户的个人信息。

        API 18添加了这个属性。


    android:restrictedAccountType
        Specifies the account type required by this application and indicates that restricted profiles are allowed to access such accounts that belong to the owner user. If your app requires an Account and restricted profiles are allowed to access the primary user‘s accounts, the value for this attribute must correspond to the account authenticator type used by your app (as defined by AuthenticatorDescription), such as "com.google".

        The default value is null and indicates that the application can work without any accounts.

        Caution: Specifying this attribute allows restricted profiles to use your app with accounts that belong to the owner user, which may reveal personally identifiable information. If the account may reveal personal details, you should not use this attribute and you should instead declare the android:requiredAccountType attribute to make your app unavailable to restricted profiles.

        This attribute was added in API level 18.

    android:restrictedAccountType
        指定应用要求的账户类型,并且表明“受限个人资料”可以访问所属用户账户。如果你的app需要一个账户,这个属性值必须与你的应用account authenticator类型一致(与通过AuthenticatorDescription定定义的一致),例如 "com.google"。

        这个默认值为null,表明应用可以在没有账户的情况下工作。

        警告:指定这个属性允许受限个人资料以所属用户账户使用你的应用,这可能会泄露个人身份信息。如果账户会泄露个人信息,你不应该使用这个属性,并且你应该声明android:requiredAccountType属性让“受限个人资料”无法访问你的应用
   
        这个属性是在API 18中引入的。


    android:supportsRtl
        Declares whether your application is willing to support right-to-left (RTL) layouts.

        If set to true and targetSdkVersion is set to 17 or higher, various RTL APIs will be activated and used by the system so your app can display RTL layouts. If set to false or if targetSdkVersion is set to 16 or lower, the RTL APIs will be ignored or will have no effect and your app will behave the same regardless of the layout direction associated to the user‘s Locale choice (your layouts will always be left-to-right).

        The default value of this attribute is false.

        This attribute was added in API level 17.

    android:supportsRtl
        声明你的应用是否愿意支持从右到左的(RTL)布局。

        如果设置为true,并且targetSdkVersion为17或者17以上,系统会使用很多RTL API,以便你的应用可以显示RTL布局。如果设置为false,或者targetSdkVersion为16或者16以下,RTL API将被忽略,或者不会生效,并且不论与用户Locale选项关联的布局方向如何,你的应用行为是一致的。(你的布局将总是从左到右的)

        这个属性的默认值是false
   
        这个属性是在API 17中引入的


    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.

        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.

    android:taskAffinity
        一个affinity名字对应用内的所有activity都适用,除了使用taskAffinity属性设置了不同的affinity的activity。更多信息参见activity的taskAffinity属性。

        默认的,应用内的所有activity共用相同的affinity。affinity的名字与<manifest>元素的包名相同。


    android:testOnly
        Indicates whether this application is only for testing purposes. For example, it may expose functionality or data outside of itself that would cause a security hole, but is useful for testing. This kind of application can be installed only through adb.

    android:testOnly
        表明这个应用是否只是用于测试。比如,它可能会暴露功能或者数据于自身之外,由此导致一个安全漏洞,但是对于测试是很有用的。这类应用只能通过adb安装。


    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.

    android:theme
        为应用中的所有activity定义一个默认的主题的一个风格资源引用。独立的activity可以通过设置它们自己的主题属性覆盖这个默认主题。更多信息,参阅Styles and Themes开发指南。

 


    android:uiOptions
       Extra options for an activity‘s UI.
       Must be one of the following values.

 

 
描述
"none"没有额外的UI选项。这个是默认值。
"splitActionBarWhenNarrow"当水平方向上空间受到限制的时候,在ActionBar中,在屏幕下面添加一个bar来显示行为条目。action bar被分为了上下两部分,而不只是几个屏幕上方action bar中显示的行为条目。这使得行为条目和屏幕上方的导航、标题元素拥有大量合理的空间。菜单项不会被分割到两个bar上,他们总是在一起出现。


    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.

android:uiOptions
    activity UI的额外选项。必须是下面值中的一个。

    没有额外的UI选项。这个是默认值。

    当水平方向上空间受到限制的时候,在ActionBar中,在屏幕下面添加一个bar来显示行为条目。
    action bar被分为了上下两部分,而不只是几个屏幕上方action bar中显示的行为条目。
    这使得行为条目和屏幕上方的导航、标题元素拥有大量合理的空间。
    菜单项不会被分割到两个bar上,他们总是在一起出现。


    android:vmSafeMode
        Indicates whether the app would like the virtual machine (VM) to operate in safe mode. The default value is "false".

    android:vmSafeMode
        表明应用是否愿意让虚拟机(VM)在安全模式下操作。默认值为false。


引入版本:
    API Level 1
另见:
    <activity>
    <service>
    <receiver>
    <provider>

 

原文地址如下,英文水平实在有限,希望拍砖同时能给予指正。

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



转贴请保留以下链接

本人blog地址

http://su1216.iteye.com/

http://blog.csdn.net/su1216/

android <application> 开发文档翻译,布布扣,bubuko.com

android <application> 开发文档翻译

原文:http://blog.csdn.net/su1216/article/details/26882917

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!