我正在使用以下代码将 Activity 作为弹出窗口打开
<activity android:name=".RadioButtonExample"
android:theme="@android:style/Theme.Dialog"
android:excludeFromRecents="true"/>
但是 excludeFromRecents
不起作用。如果用户点击后退按钮,弹出窗口会在返回主菜单时显示。
最佳答案
使用android:noHistory="true"
Whether or not the activity should be removed from the activity stack and finished (its finish() method called) when the user navigates away from it and it's no longer visible on screen — "true" if it should be finished, and "false" if not. The default value is "false". A value of "true" means that the activity will not leave a historical trace. It will not remain in the activity stack for the task, so the user will not be able to return to it.
关于androidManifest Activity android :excludeFromRecents,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8037869/