[英]How to set foreground application as not showing in recent list?
I know how to remove an application or activity from recent list by adding android:excludeFromRecents="true"
to Manifest file.我知道如何通过将
android:excludeFromRecents="true"
添加到清单文件来从最近的列表中删除应用程序或活动。 This will remove the activities when they are not in the foreground.当它们不在前台时,这将删除活动。
I tried adding the flag FLAG_ACTIVITY_CLEAR_TOP
also.我也尝试添加标志
FLAG_ACTIVITY_CLEAR_TOP
。 But, no activities on the foreground can be hidden from recent list when the home button is long pressed during that time.但是,如果在此期间长按主页按钮,则不会从最近列表中隐藏前台的任何活动。 My activity gets killed when swiped away from the recent list, while it is in the foreground.
我的活动在从最近的列表中滑出时被杀死,而它在前台。 How to remove the foreground activity or a whole foreground application from Recent list?
如何从“最近”列表中删除前台活动或整个前台应用程序?
You cannot "hide" your application from the user this way.您不能以这种方式向用户“隐藏”您的应用程序。 Tasks with running activities are always displayed in the list of recent tasks.
具有正在运行的活动的任务始终显示在最近的任务列表中。
The only way to remove your task from the list of recent tasks is to set android:noHistory="true"
on all <activity>
declarations in the manifest.从最近的任务列表中删除您的任务的唯一方法是在清单中的所有
<activity>
声明上设置android:noHistory="true"
。 However, this will cause the activities to be finished when the user navigates away from them (ie: presses the HOME button or the "recents" button, so this is probably not what you want.但是,当用户离开活动时,这将导致活动完成(即:按下 HOME 按钮或“最近”按钮,因此这可能不是您想要的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.