Chinaunix首页 | 论坛 | 博客
  • 博客访问: 892443
  • 博文数量: 322
  • 博客积分: 6688
  • 博客等级: 准将
  • 技术积分: 3626
  • 用 户 组: 普通用户
  • 注册时间: 2010-09-19 11:26
文章分类

全部博文(322)

文章存档

2013年(5)

2012年(66)

2011年(87)

2010年(164)

分类: Java

2010-12-31 23:38:35

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
 android:allowTaskReparenting=["true" | "false"]
              android:alwaysRetainTaskState=["true" | "false"]
              android:clearTaskOnLaunch=["true"" | "false"]
              android:configChanges=[one or more of: "mcc" "mnc" "locale"
                                     "touchscreen" "keyboard" "keyboardHidden"
                                     "navigation" "orientation" "fontScale"]
              android:enabled=["true" | "false"]
              android:excludeFromRecents=["true" | "false"]
              android:exported=["true" | "false"]
              android:finishOnTaskLaunch=["true" | "false"]
              android:icon="drawable resource"
              android:label="string resource"
              android:launchMode=["multiple" | "singleTop" |
                                  "singleTask" | "singleInstance"]
              android:multiprocess=["true" | "false"]
              android:name="string"
              android:noHistory=["true" | "false"]  
              android:permission="string"
              android:process="string"
              android:screenOrientation=["unspecified" | "user" | "behind" |
                                         "landscape" | "portrait" |
                                         "sensor" | "nonsensor"]
              android:stateNotNeeded=["true" | "false"]
              android:taskAffinity="string"
              android:theme="resource or theme"
              android:windowSoftInputMode=[one or more of: "stateUnspecified"
                                           "stateUnchanged" "stateHidden"
                                           "stateAlwaysHidden" "stateVisible"
                                           "stateAlwaysVisible" "adjustUnspecified"
                                           "adjustResize" "adjustPan"] >   
        . . .
    >

contained in:隶属于:

can contain:可以包含:

description:说明:
Declares an activity (an Activity subclass) that implements part of the application’s visual user interface. All activities must be represented by elements in the manifest file. Any that are not declared there will not be seen by the system and will never be run.
声明一个activity(一个Activity子类),它实现了应用程序的可视界面的一部分。所有activity都必须用manifest文件的元素声明。系统将无法看到任何没有被声明的activity,也就无法运行之。

attributes:属性:

android:allowTaskReparenting
Whether or not the activity can move from the task that started it to the task it has an affinity for when that task is next brought to the front — “true” if it can move, and “false” if it must remain with the task where it started.
activity是否可以从启动它的task移动到之后被带到前台的跟它有affinity的task里 — “true”表示它可以被移动,”false”表示它必须留在启动它的task里。

If this attribute is not set, the value set by the corresponding allowTaskReparenting attribute of the element applies to the activity. The default value is “false”.
如果该属性未设置,元素对应的allowTaskReparenting属性值将适用于该activity。默认值是”false”。

Normally when an activity is started, it’s associated with the task of the activity that started it and it stays there for its entire lifetime. You can use this attribute to force it to be re-parented to the task it has an affinity for when its current task is no longer displayed. Typically, it’s used to cause the activities of an application to move to the main task associated with that application.
通常当一个activity开始后,它与启动它的activity的task相关联,并且整个生命周期都留在那里。你可以利用本属性在当前task 不再被显示时,将它强制重定位到跟它有affinity的task里。通常,它用来促使一个应用程序的activity移动到与那个应用程序关联的主 task里去。

For example, if an e-mail message contains a link to a web page, clicking the link brings up an activity that can display the page. That activity is defined by the browser application, but is launched as part of the e-mail task. If it’s reparented to the browser task, it will be shown when the browser next comes to the front, and will be absent when the e-mail task again comes forward.
例如,如果一个e-mail信息包含一个到某网页的链接,点击该链接生成能显示该页面的一个activity。那个activity由浏览器应用程序定义,但是被作为一个e-mail task的一部分加载进来。如果它被重定位到浏览器task,在那个浏览器之后来到前台时它将被显示,并且当e-mail task重新来到前台时不再被显示。

The affinity of an activity is defined by the taskAffinity attribute. The affinity of a task is determined by reading the affinity of its root activity. Therefore, by definition, a root activity is always in a task with the same affinity. Since activities with “singleTask” or “singleInstance” launch modes can only be at the root of a task, re-parenting is limited to the “standard” and “singleTop” modes. (See also the launchMode attribute.)
activity的affinity由taskAffinity属性定义。一个task的affinity决定于它的根activity的 affinity。因此,理所当然的,一个根activity总是在一个task里,带有相同的affinity。因为”singleTask” 或”singleInstance”载入模式的activity只能够在某个task的根部,重定父级仅仅适用于”standard” 和”singleTop”模式。(参照launchMode属性。)
android:alwaysRetainTaskState 总是保持task状态
Whether or not the state of the task that the activity is in will always be maintained by the system — “true” if it will be, and “false” if the system is allowed to reset the task to its initial state in certain situations. The default value is “false”. This attribute is meaningful only for the root activity of a task; it’s ignored for all other activities.
系统是否将总是维护该activity所在task的状态 — “true”表示将会这样,”false”表示允许系统在某些情况下重新设置该task到它的初始状态。默认值是”false”。该属性值只对task的根activity有意义;对于其他activity将被忽略。

Normally, the system clears a task (removes all activities from the stack above the root activity) in certain situations when the user re-selects that task from the home screen. Typically, this is done if the user hasn’t visited the task for a certain amount of time, such as 30 minutes.
通常,系统当用户在主屏幕上重选该task的特定情况下清空一个task(移除stack里根activity上面的所有activity)。通常,出现这种情况是在用户超过了某个特定的时间间隔仍然没有访问该task,例如30分钟。

However, when this attribute is “true”, users will always return to the task in its last state, regardless of how they get there. This is useful, for example, in an application like the web browser where there is a lot of state (such as multiple open tabs) that users would not like to lose.
然而,当本属性为”true”时,用户将总是回到该task的最新状态,无论他们怎么过去的。这个很有用,例如,在一个类似网络浏览器的应用程序里,这儿有许多用户不愿失去的状态(比如打开的复数的标签页)。
android:clearTaskOnLaunch 载入时清空task
Whether or not all activities will be removed from the task, except for the root activity, whenever it is re-launched from the home screen — “true” if the task is always stripped down to its root activity, and “false” if not. The default value is “false”. This attribute is meaningful only for activities that start a new task (the root activity); it’s ignored for all other activities in the task.
当任何时候从主页屏幕重新载入时,是否移除task里除了根activity的所有activity — “true”表示该task总是被拆分至根activity,”false”表示不是。默认值为”false”。本属性只对开始一个新task的 activity(根activity)有意义;对于task里的其他activity将被忽略。

When the value is “true”, every time users start the task again, they are brought to its root activity, regardless of what they were last doing in the task and regardless of whether they used BACK or HOME to last leave it. When the value is “false”, the task may be cleared of activities in some situations (see the alwaysRetainTaskState attribute), but not always.
当值为”true”时,每当用户再次启动该task,他们都将被带到它的根activity,不管他们在该task里最后执行过什么操作,也不管最终离开时他们是否使用BACK或HOME键。当值为”false”时,在某些情况下task可能清空它的activity(参照 alwaysRetainTaskState属性),但不总是那样。

Suppose, for example, that someone launches activity P from the home screen, and from there goes to activity Q. The user next presses HOME, and then returns to activity P. Normally, the user would see activity Q, since that is what they were last doing in P’s task. However, if P set this flag to “true”, all of the activities on top of it (Q in this case) were removed when the user pressed HOME and the task went to the background. So the user sees only P when returning to the task.
假如,某人从主页屏幕载入activity P,并从那儿到达activity Q。用户接下来按了HOME键,然后返回到activity P。通常,用户将看到activity Q,因为那时他在P的task里操作的地方。然而,如果P将该标志设为”true”,当用户按了HOME键,该task进到后台去的时候,其上的所有的 activity(Q也属于这种情况)将被移除。所以以后回到该task时看到的只有P。

If this attribute and allowTaskReparenting are both “true”, any activities that can be re-parented are moved to the task they share an affinity with; the remaining activities are then dropped, as described above.
如果本属性和allowTaskReparenting都是”true”,任何能够被重定父级的activity都将移动到那个跟它有同一affinity的task里去;接着如上所述,剩下的activity将被丢弃。
android:configChanges 配置变更
Lists configuration changes that the activity will handle itself. When changes that are not listed occur, the activity is shut down and restarted. When a listed change occurs, the activity remains running and its onConfigurationChanged() method is called.
列举activity自己将处理的配置变更。当没有被列举的变更发生时,该activity将关闭并重启。当被列举的变更发生时,该activity将继续运行并调用它的onConfigurationChanged()方法。

Any or all of the following strings can be used to set this attribute. Values are separated by ‘|’ — for example, “locale|navigation|orientation”.
下面列举的任何或所有的字符串能够被用来设置本属性。值用’|'分隔 — 例如,”locale|navigation|orientation”。

Value值 Description说明
“mcc” The IMSI mobile country code (MCC) has changed — that is, a SIM has been detected and updated the MCC.
国际移动用户识别码的移动国家码(MCC)变更 — 就是说,检测到一个SIM并更新MCC。
“mnc” The IMSI mobile network code (MNC) has changed — that is, a SIM has been detected and updated the MNC.
国际移动用户识别码的移动网络码(MNC)变更 — 就是说,检测到一个SIM并更新MNC。
“locale” The locale has changed — for example, the user has selected a new language that text should be displayed in.
locale变更 — 例如,用户选择了一个新的语言用来显示文本。
“touchscreen” The touchscreen has changed. (This should never normally happen.)
触摸屏变更。(这个通常不发生。)
“keyboard” The keyboard type has changed — for example, the user has plugged in an external keyboard.
键盘型号变更 — 例如,用户插上了一个扩展键盘。
“keyboardHidden” The keyboard accessibility has changed — for example, the user has slid the keyboard out to expose it.
键盘访问性变更 — 例如,用户拔掉了键盘从而无法使用它。
“navigation” The navigation type has changed. (This should never normally happen.)
导航种类变更。(这个通常不发生。)
“orientation” The screen orientation has changed — that is, the user has rotated the device.
屏幕方位变更 — 就是说,用户旋转了设备。
“fontScale” The font scaling factor has changed — that is, the user has selected a new global font size.
字体缩放系数变更 — 就是说,用户选择了一个新的全局的字体大小。

*国际移动用户识别码(IMSI) International Mobile Subscriber Identity

国际上为唯一识别一个移动用户所分配的号码。

从技术上讲,IMSI可以彻底解决国际漫游问题。但是由于北美目前仍有大量的AMPS系统使用MIN号码,且北美的MDN和MIN采用相同的编号,系统已经无法更改,所以目前国际漫游暂时还是以MIN为主。其中以O和1打头的MIN资源称为IRM(International Roaming MIN),由IFAST (International Forum on ANSI-41 Standards Technology)统一管理。目前联通申请的IRM资源以09打头。可以看出,随着用户的增长,用于国际漫游的MIN资源将很快耗尽,全球统一采用 IMSI标识用户势在必行.

IMSI共有15位,其结构如下:
MCC+MNC+MIN
MCC:Mobile Country Code,移动国家码,共3位,中国为460;
MNC:Mobile Network Code,移动网络码,共2位,联通CDMA系统使用03,一个典型的IMSI号码为460030912121001;

MIN共有10位,其结构如下:
09+M0M1M2M3+ABCD
其中的M0M1M2M3和MDN号码中的H0H1H2H3可存在对应关系,ABCD四位为自由分配。

可以看出IMSI在MIN号码前加了MCC,可以区别出每个用户的来自的国家,因此可以实现国际漫游。在同一个国家内,如果有多个CDMA运营商,可以通过MNC来进行区别.

International Mobile Station Identity — 国际移动台标识

All of these configuration changes can impact the resource values seen by the application. Therefore, when onConfigurationChanged() is called, it will generally be necessary to again retrieve all resources (including view layouts, drawables, and so on) to correctly handle the change.
所有这些配置变更能够影响应用程序所能看到的资源值。因此,当onConfigurationChanged()被调用时,它将通常需要再次恢复所有资源(包括视图的布局,显示元素,等等)来正确地对应这些变更。
android:enabled 允许
Whether or not the activity can be instantiated by the system — “true” if it can be, and “false” if not. The default value is “true”.
activity是否能够被系统实例化 — “true”表示可以,”false”表示不可以。默认值为”true”。

The element has its own enabled attribute that applies to all application components, including activities. The and attributes must both be “true” (as they both are by default) for the system to be able to instantiate the activity. If either is “false”, it cannot be instantiated.
元素有它自己的enabled属性,提供给应用程序的所有组件,包括 activity。的属性必须都为”true”(比如它们都是默认值),系统才能够实例化该activity。如果有任意一方为”false”,它将不能被实例化。
android:excludeFromRecents 排除在当前之外
Whether or not the activity should be excluded from the list of recently launched activities that can be displayed to users — “true” if it should be excluded, and “false” if it should be included. The default value is “false”.
该activity是否会被排除在当前被载入的能够被显示给用户的activity清单之外 — “true”表示将被排除,”false”表示将被包括。默认值为”false”。

android:exported 对外的
Whether or not the activity can be launched by components of other applications — “true” if it can be,
and “false” if not. If “false”, the activity can be launched only by components of the same application or applications with the same user ID.
activity是否能够被其他应用程序的组件载入 — “true”表示可以,”false”表示不可以。如果是”false”,该activity值可以被同一应用程序或拥有相同用户ID的应用程序的组件载入。

The default value depends on whether the activity contains intent filters. The absence of any filters means that the activity can be invoked only by specifying its exact class name. This implies that the activity is intended only for application-internal use (since others would not know the class name). So in this case, the default value is “false”. On the other hand, the presence of at least one filter implies that the activity is intended for external use, so the default value is “true”.
默认值取决于该activity是否含有intent filter。没有任何filter意味着该activity仅能够被明确指定的类名调用。这意味着该activity意在被应用程序-内部使用(因为其他的将不知道该类名)。所以在本情况下,默认值是”false”。另一方面,如果至少有一个filter意味着该activity可以被外部使用,这样默认值就是”true”。

This attribute is not the only way to limit an activity’s exposure to other applications. You can also use a permission to limit the external entities that can invoke the activity (see the permission attribute).
本属性不是唯一的限制activity暴露给其他应用程序的唯一途径。你也可以使用权限去限制外部的访问控制对该activity的调用(参照permission属性)。
android:finishOnTaskLaunch 在task载入时结束
Whether or not an existing instance of the activity should be shut down (finished) whenever the user again launches its task (chooses the task on the home screen) — “true” if it should be shut down, and “false” if not. The default value is “false”.
当用户再次载入该task时(在主页屏幕上选择该task),一个既存的activity实例是否应该被关闭(结束) — “true”表示会被关闭,”false”表示不是。默认值为”false”。

If this attribute and allowTaskReparenting are both “true”, this attribute trumps the other. The affinity of the activity is ignored. The activity is not re-parented, but destroyed.
如果本属性和allowTaskReparenting都被设置为”true”,本属性优先于其他。该activity的affinity被忽略。该activity不会被重定父级,而是被摧毁。
android:icon 图标
An icon representing the activity. The icon is displayed to users when a representation of the activity is required on-screen. For example, icons for activities that initiate tasks are displayed in the launcher window. The icon is often accompanied by a label (see the label attribute).
一个图标代表该activity。当该activity的标志需要在屏幕上出现时,该图标将被显示给用户。例如,显示在启动器窗口的用来初始化task的activity的图标。该图标通常与一个标签同时出现(参照标签属性)。

This attribute must be set as a reference to a drawable resource containing the image definition. If it is not set, the icon specified for the application as a whole is used instead (see the element’s icon attribute).
本属性必须设置一个对包含图像定义的可绘制资源的参照。如果没有设置,指定给application的图标将被拿来替代它使用(参照元素的icon属性)。

The activity’s icon — whether set here or by the element — is also the default icon for all the activity’s intent filters (see the element’s icon attribute).
activity的图标 — 无论设置在这儿或是从元素来的 — 也同样是该activity所有的intent filter的默认图标(参照元素的icon属性)。
android:label 标签
A user-readable label for the activity. The label is displayed on-screen when the activity must be represented to the user. It’s often displayed along with the activity icon.
该activity的用户可读的标签。当该activity必须被显示给用户时,该标签将显示在屏幕上。它通常与该activity的图标一起出现。

If this attribute is not set, the label set for the application as a whole is used instead (see the element’s label attribute).
如果本属性没有设置,设置给application的标签将代替它被使用(参照元素的label属性)。

The activity’s label — whether set here or by the element — is also the default label for all the activity’s intent filters (see the element’s label attribute).
该activity的标签 — 无论设置在这儿还是从元素来的 — 也同样是该activity的所有intent filter的默认标签(参照元素的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:launchMode 载入模式
An instruction on how the activity should be launched. There are four modes that work in conjunction with activity flags (FLAG_ACTIVITY_* constants) in Intent objects to determine what should happen when the activity is called upon to handle an intent. They are:
activity如何被载入的指令。这儿有四种模式,与Intent对象里的activity标识相互合作(FLAG_ACTIVITY_* 常量)来决定当activity被调用来处理一个intent时应该发生什么。它们是:

“standard”
“singleTop”
“singleTask”
“singleInstance”

The default mode is “standard”.
默认模式是”standard”。

The modes fall into two main groups, with “standard” and “singleTop” activities on one side, and “singleTask” and “singleInstance” activities on the other. An activity with the “standard” or “singleTop” launch mode can be instantiated multiple times. The instances can belong to any task and can be located anywhere in the activity stack. Typically, they’re launched into the task that called startActivity() (unless the Intent object contains a FLAG_ACTIVITY_NEW_TASK instruction, in which case a different task is chosen — see the taskAffinity attribute).
模式分成两大组,”standard”和”singleTop”activity为一组,”singleTask” 和”singleInstance”activity为另外一组。一个带有”standard”或”singleTop”载入模式的activity能够被实例化若干次。实例可以属于任何task,能够被放置在activity stack的任何位置。通常,通过调用startActivity() 将它们载入到task里(除非Intent对象包含FLAG_ACTIVITY_NEW_TASK 指令,这种情况下会选择一个不同的task — 参照taskAffinity属性)。

In contrast, “singleTask” and “singleInstance” activities can only begin a task. They are always at the root of the activity stack. Moreover, the device can hold only one instance of the activity at a time — only one such task.
相反,”singleTask”和”singleInstance”activity只能开始一个task。它们总是位于activity stack的根部。并且,设备在同一时刻只能有一个该activity的实力存在 — 只有一个这样的task。

The “standard” and “singleTop” modes differ from each other in just one respect: Every time there’s new intent for a “standard” activity, a new instance of the class is created to respond to that intent. Each instance handles a single intent. Similarly, a new instance of a “singleTop” activity may also be created to handle a new intent. However, if the target task already has an existing instance of the activity at the top of its stack, that instance will receive the new intent (in an onNewIntent() call); a new instance is not created. In other circumstances — for example, if an existing instance of the “singleTop” activity is in the target task, but not at the top of the stack, or if it’s at the top of a stack, but not in the target task — a new instance would be created and pushed on the stack.
“standard”和”singleTop”模式之间只有一点不一样:每当这儿有一个新的intent请求一个”standard”activity时,将会生成该类的一个新的实例来响应那个intent。每个实例持有一个单一的intent。类似的,也会生成一个”singleTop” activity新实例来持有一个新的intent。然而,如果目标task已经有一个该activity的现存的实例位于它的stack的最上面,那个实力将接收这个新的intent(通过调用onNewIntent());而不会生成新的实例。在其他情况下 — 例如,如果一个目标task里有一个现存的”singleTop” activity的实例,但是不是位于stack的最上面,或者它虽然位于stack的最上面,但是不在目标task里 — 将生成一个新的实例并且压进那个stack里去。

The “singleTask” and “singleInstance” modes also differ from each other in only one respect: A “singleTask” activity allows other activities to be part of its task. It’s at the root of the activity stack, but other activities (necessarily “standard” and “singleTop” activities) can be launched into the same task. A “singleInstance” activity, on the other hand, permits no other activities to be part of its task. It’s the only activity in the task. If it starts another activity, that activity is assigned to a different task — as if FLAG_ACTIVITY_NEW_TASK was in the intent.
“singleTask”和”singleInstance”模式也只有一个方面不一样:一个”singleTask” activity允许其他的activity作为它的task里的一部分。它位于activity stack的根部,但是其他activity(必须是”standard”或”singleTop”activity)能够被载入进同一个task里。一个”singleInstance”activity,另一方面,不允许其他的activity在它的task里。它是该task里仅存的 activity。如果它开始了另外一个activity,那个activity将被分配到其他的task里去 — 如同intent里设置了FLAG_ACTIVITY_NEW_TASK一样。

For more information on launch modes and their interaction with Intent flags, see the Activities and Tasks section of the Application Fundamentals document.
载入模式以及它们与intent标识之间协作的更多相关信息,参照Application Fundamentals文档的Activities and Tasks章节。
android:multiprocess 多进程
Whether an instance of the activity can be launched into the process of the component that started it — “true” if it can be, and “false” if not. The default value is “false”.
activity的实例是否能够被载入到启动它的组件所在进程里 — “true”表示可以,”false”表示不行。默认值是”false”。

Normally, a new instance of an activity is launched into the process of the application that defined it, so all instances of the activity run in the same process. However, if this flag is set to “true”, instances of the activity can run in multiple processes, allowing the system to create instances wherever they are used (provided permissions allow it), something that is almost never necessary or desirable.
通常,一个activity的新实例被载入到定义它的应用程序进程里,这样一来,该activity的所有实例运行在同一进程里。然而,如果本标识设为”true”的话,activity的实例就能够运行在多个进程里,允许系统只要使用它时就生成实例(提供的权限允许的话),某些几乎根本不需要或根本不合适。
android:name 名字
The name of the class that implements the activity, a subclass of Activity. The attribute value should be a fully qualified class name (such as, “com.example.project.ExtracurricularActivity”). However, as a shorthand, if the first character of the name is a period (for example, “.ExtracurricularActivity”), it is appended to the package name specified in the element.
实现了activity的类的名字,Activity的一个子类。该属性值应该是一个完整的类名(比如,”com.example.project.ExtracurricularActivity”)。然而,作为一个缩写,如果名字的第一个字符是一个句号(例如,”.ExtracurricularActivity”),它会追加在元素里指定的包名。

There is no default. The name must be specified.
没有默认值,名字必须被指定。
android:noHistory 无履历
Whether or not the activity should be removed from the activity stack and finished (its finish() method called) when the user navigates away from it and it’s no longer visible on screen — “true” if it should be finished, and “false” if not. The default value is “false”.
当用户离开它且它不再显示在屏幕上时,activity是否应该被从activity stack里移除并且结束掉(调用它的finish()方法) — “true”表示应该结束,”false”表示不。默认值是”false”。

A value of “true” means that the activity will not leave a historical trace. It will not remain in the activity stack for the task, so the user will not be able to return to it.
值为”true”意味着该activity将不会留下履历。它将不会留在该task的activity stack里,用户也将无法返回到它。

This attribute was introduced in API Level 3.
本属性在API Level 3里导入。
android:permission 许可
The name of a permission that clients must have to launch the activity or otherwise get it to respond to an intent. If a caller of startActivity() or startActivityForResult() has not been granted the specified permission, its intent will not be delivered to the activity.
客户端载入activity,要不然就是响应一个intent所必须拥有的许可名称。如果一个startActivity()或 startActivityForResult()的调用者没有被赋予指定的许可,它的intent将不会被发送给activity。

If this attribute is not set, the permission set by the element’s permission attribute applies to the activity. If neither attribute is set, the activity is not protected by a permission.
如果本属性没有被设置,元素的permission属性所设置的许可将适用于该activity。如果两边的属性都没有被设置,该activity将不被许可保护。

For more information on permissions, see the Permissions section in the introduction and another document, Security and Permissions.
更多许可相关信息,参照引论的Permissions章节和其他文档,Security and Permissions。
android:process 进程
The name of the process in which the activity should run. Normally, all components of an application run in the default process created for the application. It has the same name as the application package. The element’s process attribute can set a different default for all components. But each component can override the default, allowing you to spread your application across multiple processes.
activity应该运行的进程的名字。通常,一个应用程序的所有组件运行在为该应用程序生成的默认的进程里。它与应用程序包同名。元素的process属性能够给所有的组件设置一个不同的默认值。但是每个组件可以覆盖该默认值,允许你扩展你的应用程序到多个进程里。

If the name assigned to this attribute begins with a colon (‘:’), a new process, private to the application, is created when it’s needed and the activity runs in that process. If the process name begins with a lowercase character, the activity will run in a global process of that name, provided that it has permission to do so. This allows components in different applications to share a process, reducing resource usage.
如果本属性指定的名字以冒号开始(‘:’),当需要的时候将会生成该应用程序的一个新的私有进程,activity将运行在那个进程里。如果进程名由一个小写字母开头,activity将运行在一个该名字的全局的进程里,如果它有那个许可的话。这样就允许不同的应用程序组件共享同一进程,从而降低资源消耗。
android:screenOrientation
The orientation of the activity’s display on the device. The value can be any one of the following strings:
activity显示在设备上的方位。可以设置为下列的任一字符串:
“unspecified” The default value. The system chooses the orientation. The policy it uses, and therefore the choices made in specific contexts, may differ from device to device.
默认值。由系统选择方位。它使用的方案,以及由于选择时所处的不同上下文,设备间可以不同。
“landscape” Landscape orientation (the display is wider than it is tall).
横向方位(横向大于纵向显示)。
“portrait” Portrait orientation (the display is taller than it is wide).
纵向方位(纵向大于横向显示)。
“user” The user’s current preferred orientation.
用户当前首选方位。
“behind” The same orientation as the activity that’s immediately beneath it in the activity stack.
与activity stack里在它紧下面的activity相同的方位。
“sensor” The orientation determined by a physical orientation sensor. The orientation of the display depends on how the user is holding the device; it changes when the user rotates the device.
由一个物理的方位感应器决定方位。方位依赖于用户如何持有该设备;如果用户旋转了该设备,方位也会随之变化。
“nosensor” An orientation determined without reference to a physical orientation sensor. The sensor is ignored, so the display will not rotate based on how the user moves the device. Except for this distinction, the system chooses the orientation using the same policy as for the “unspecified” setting.
不是由一个物理的方位感应器决定方位。感应器被忽略,所以显示不会跟随用户设备而变化。除了这个差别,系统使用与”unspecified”设置相同的方案选择方位。

android:stateNotNeeded
Whether or not the activity can be killed and successfully restarted without having saved its state — “true” if it can be restarted without reference to its previous state, and “false” if its previous state is required. The default value is “false”.
activity是否能够不保存其状态被杀掉后重新成功启动 — “true”表示可以在不参照之前的状态的情况下重新启动,”false”表示它之前的状态是需要的。默认值为”false”。

Normally, before an activity is temporarily shut down to save resources, its onSaveInstanceState() method is called. This method stores the current state of the activity in a Bundle object, which is then passed to onCreate() when the activity is restarted. If this attribute is set to “true”, onSaveInstanceState() may not be called and onCreate() will be passed null instead of the Bundle — just as it was when the activity started for the first time.
通常,在一个activity暂时关闭时为了节约资源,调用它的onSaveInstanceState()方法。本方法将该activity的当前状态储存到一个Bundle对象里,在之后该activity重启时传给onCreate()方法。如果本属性设为”true”,onSaveInstanceState()将不会被调用,并将一个null传给onCreate(),而不是Bundle — 如同该activity第一次被启动时一样。

A “true” setting ensures that the activity can be restarted in the absence of retained state. For example, the activity that displays the home screen uses this setting to make sure that it does not get removed if it crashes for some reason.
设置为”true”确保activity能够在无状态情况下被重启。例如,显示在主页屏幕上的activity使用本设置确保如果由于某些原因崩溃后它也不会被移除。
android:windowSoftInputMode
How the main window of the activity interacts with the window containing the on-screen soft keyboard. The setting for this attribute affects two things:
activity住窗口如何与包含屏幕软键盘的窗口交互。本属性的设置影响两件事:

* The state of the soft keyboard — whether it is hidden or visible — when the activity becomes the focus of user attention.
软键盘状态 — 隐藏或显示 —当本activity成为用户关心的焦点时。
* The adjustment made to the activity’s main window — whether it is resized smaller to make room for the soft keyboard or whether its contents pan to make the current focus visible when part of the window is covered by the soft keyboard.
对于activity主窗口的调节 — 是否将窗口变小以留出空间给软键盘,或当一部分窗口被软键盘覆盖时,是否将它的目录移动从而使当前的焦点可视。

The setting must be one of the values listed in the following table, or a combination of one “state…” value plus one “adjust…” value. Setting multiple values in either group — multiple “state…” values, for example — has undefined results. Individual values are separated by a vertical bar (|). For example:
该设置必须是下列表里所列出的值之一,或者是某一个”state…”值加上一个”adjust…”值的组合。设置多个值在任意的组里 — 多个”state…”值,例如 — 有未定义的结果。各个值间用竖线分隔(|)。例如:

Values set here (other than “stateUnspecified” and “adjustUnspecified”) override values set in the theme.
设置在这里的值(除了”stateUnspecified”和”adjustUnspecified”以外)将覆盖设置在主题里的值。
Value Description
“stateUnspecified” The state of the soft keyboard (whether it is hidden or visible) is not specified. The system will choose an appropriate state or rely on the setting in the theme.

This is the default setting for the behavior of the soft keyboard.
软键盘状态(是否可视或隐藏)未被指定。系统将选择一个合适的状态或者依赖主题里的设置。
这是软键盘行为的默认设置。
“stateUnchanged” The soft keyboard is kept in whatever state it was last in, whether visible or hidden, when the activity comes to the fore.
当该activity来到前台时,软键盘将保持它之前最后的状态,无论是可视还是隐藏。
“stateHidden” The soft keyboard is hidden when the user chooses the activity — that is, when the user affirmatively navigates forward to the activity, rather than backs into it because of leaving another activity.
当用户选择该activity时,软键盘被隐藏 — 就是说,当用户主动地浏览到该activity,而不是因为离开另外一个activity返回到它。
“stateAlwaysHidden” The soft keyboard is always hidden when the activity’s main window has input focus.
当该activity的主窗口获得焦点时,软键盘总是被隐藏。
“stateVisible” The soft keyboard is visible when that’s normally appropriate (when the user is navigating forward to the activity’s main window).
软键盘可视,这是通常适用的(当用户浏览到该activity的主窗口)。
“stateAlwaysVisible” The soft keyboard is made visible when the user chooses the activity — that is, when the user affirmatively navigates forward to the activity, rather than backs into it because of leaving another activity.
当用户选择该activity时,软键盘可视 — 就是说,当用户主动地浏览到该activity,而不是因为离开其他activity返回到它。
“adjustUnspecified” It is unspecified whether the activity’s main window resizes to make room for the soft keyboard, or whether the contents of the window pan to make the currentfocus visible on-screen. The system will automatically select one of these modes depending on whether the content of the window has any layout views that can scroll their contents. If there is such a view, the window will be resized, on the assumption that scrolling can make all of the window’s contents visible within a smaller area.
This is the default setting for the behavior of the main window.
未指定是否改变activity主窗口大小来为软键盘腾出空间,或是否滑动窗口内容以使当前焦点在屏幕上可视。系统将自动的选择其中的一个模式,依赖于窗口内容是否有可以滚动它们内容的任何布局方式。如果这儿有这么一个方式,窗口将被改变大小,假设滚动可以使窗口的所有内容在一个更小的区域里可视。
这是主窗口行为的默认设置。
“adjustResize” The activity’s main window is always resized to make room for the soft keyboard on screen.
activity的主窗口总是改变大小来为软键盘在屏幕上腾出空间。
“adjustPan” The activity’s main window is not resized to make room for the soft keyboard. Rather, the contents of the window are automatically panned so that the current focus is never obscured by the keyboard and users can always see what they are typing. This is generally less desireable than resizing, because the user may need to close the soft keyboard to get at and interact with obscured parts of the window.
activity的主窗口将不会改变大小来为软键盘腾出空间。而是,窗口内容将动态滚动,这样一来,当前焦点将不会被键盘遮住,用户总是能够看到他们正在输入什么。这个通常不如改变大小,因为用户可能需要关闭软键盘来与窗口被遮住的部分交互。

阅读(999) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~