我正在从一项服务启动一项 Activity ,并希望它出现在最近的应用程序列表中。
但是,如果我退出应用程序(例如,按下调用 finish() 的 Activity UI 上的按钮),我希望该 Activity 从最近的应用程序列表中删除。
使用 android:excludeFromRecents="true"
从最近的应用程序列表中排除 Activity 不会给我所需的初始 Activity 行为,即出现在最近的应用程序列表中的 Activity 。
这可能吗?
最佳答案
使用
android:excludeFromRecents="true"
对于 list 文件中的 Activity
android:excludeFromRecents
Whether or not the task initiated by this activity should be excluded from the list of recently used applications ("recent apps"). That is, when this activity is the root activity of a new task, this attribute determines whether the task should not appear in the list of recent apps. Set "true" if the task should be excluded from the list; set "false" if it should be included. The default value is "false".
关于android - 如何在完成时从最近的应用程序列表中删除 Activity ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21875653/