Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲
 Android教程網 >> Android技術 >> 關於Android編程 >> android (application) 開發文檔翻譯

android (application) 開發文檔翻譯

編輯:關於Android編程

由於本人英文能力實在有限,不足之初敬請諒解

本博客只要沒有注明“轉”,那麼均為原創,轉貼請注明本博客鏈接鏈接



語法:
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"] >
. . .


包含在:


可以包含:









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 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。

元素有其自己的allowTaskReparenting屬性,並且可以覆蓋這裡設置的值。更多信息參見的屬性

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

There is no default. The name must be specified.

android:backupAgent
實現應用的備份代理的類的名字,BackupAgent的一個子類。屬性值應該是一個全限定類名(例如,"com.example.project.MyBackupAgent")。然而,如果名字的第一個字符是點的話可以作為簡寫(例如,".MyBackupAgent"),它追加在元素中指定的包名後面。

這個屬性沒有默認值。必須指定類名才行。

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 , , , , and 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
應用的全局圖標,也是應用每個組件的默認圖標。參見, , , , 和 元素的獨立的圖標屬性。

這個屬性必須設置為是引用一個包含圖片的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 , , , , and 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
整個應用的一個可被用戶讀取的標簽,也是應用中每個組件的默認標簽。見, , , , 和 元素獨立的標簽屬性。

標簽應該是引用一個字符串資源,以便可以像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 element.

android:manageSpaceActivity
系統可以啟動的讓用戶管理應用在設備上占用內存的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 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為應用創建進程。所有組件則都運行在這個進程中。默認進程的名字與元素中設置的包名一致。

通過設置這個屬性來指定一個進程名來與另一個應用共用進程,你可以讓兩個應用的組件運行在用一個進程中 - 但是只能是兩個應用也共享一個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 element.

android:taskAffinity
一個affinity名字對應用內的所有activity都適用,除了使用taskAffinity屬性設置了不同的affinity的activity。更多信息參見activity的taskAffinity屬性。

默認的,應用內的所有activity共用相同的affinity。affinity的名字與元素的包名相同。


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
另見:



原文地址如下,英文水平實在有限,希望拍磚同時能給予指正。

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



轉貼請保留以下鏈接

本人blog地址

http://su1216.iteye.com/

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

  1. 上一頁:
  2. 下一頁:
熱門文章
閱讀排行版
Copyright © Android教程網 All Rights Reserved