Android:Allow Task Reparenting:[boolean]

来源:互联网 发布:支持向量回归算法 编辑:程序博客网 时间:2024/05/17 17:39
是否允许这个Activity从启动它的这个Activity所在的Task转移到和它有相同亲和力的Task。默认值为false。

例如,在一个e-mail里,包含一个超链接。而用来显示超链接页面的Activity是在浏览器这个应用中定义的。如果用来显示超链接页面的Activity允许reparent到浏览器这个应用的话,当下次浏览器这个应用运行到前台的时候,这次打开的超链接的这个页面会再次显示,而当e-mail这个应用再次运行到前台的时候,打开超链接的这个Activity不会再次显示。因为在第一次打开这个超链接页面之后,e-mail应用运行在后台时,这个打开超链接的Activity已经reparent到了浏览器的task。
英文说明:

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.

If this attribute is not set, the value set by the corresponding allowTaskReparenting attribute of the <application> element applies to the activity. The default value is "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.

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.

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.)
0 0
原创粉丝点击