gpt4 book ai didi

android - 属性 clearTaskOnLaunch 与 finishOnTaskLaunch 之间有什么区别?

转载 作者:搜寻专家 更新时间:2023-11-01 08:00:24 24 4
gpt4 key购买 nike

根据文档:

android:clearTaskOnLaunch

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.

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 the Back or Home button to leave it. When the value is "false", the task may be cleared of activities in some situations (see the alwaysRetainTaskState attribute), but not always.

android:finishOnTaskLaunch

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

我看到这两个属性之间的措辞截然不同,但我无法意识到它们之间的实际差异。有什么帮助吗?

最佳答案

clearTaskOnLaunch

如果在任务的根 Activity 中将此属性设置为“true”,则每当用户离开任务并返回时,堆栈将被清除到根 Activity 。

finishOnTaskLaunch

此属性类似于 clearTaskOnLaunch,但它作用于单个 Activity ,而不是整个任务。它还可能导致任何 Activity 消失,包括根 Activity 。当它设置为“true”时, Activity 仅在当前 session 中保留为任务的一部分。如果用户离开然后返回任务,则它不再存在。

refer this blog

关于android - 属性 clearTaskOnLaunch 与 finishOnTaskLaunch 之间有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22087240/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com