- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
根据文档:
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 中保留为任务的一部分。如果用户离开然后返回任务,则它不再存在。
关于android - 属性 clearTaskOnLaunch 与 finishOnTaskLaunch 之间有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22087240/
根据文档: android:clearTaskOnLaunch Whether or not all activities will be removed from the task, except
我是一名优秀的程序员,十分优秀!