隐藏resent记录,隐藏菜单栏记录

在唤醒app的activity 的manifest加上一句

android:excludeFromRecents="true"

有几个唤醒的就加几个 


<activity
    android:excludeFromRecents="true"
    android:name=".activity.SplashActivity"
    android:exported="true"
    android:hardwareAccelerated="true"
    android:screenOrientation="portrait">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>
<activity
    android:excludeFromRecents="true"
    android:name=".activity.MainActivity"
    android:exported="true"
    android:hardwareAccelerated="true"
    android:label="@string/app_name"
    android:launchMode="singleTask"
    android:screenOrientation="portrait">
</activity>

这句代码只要是启动的根activity 就会隐藏recent记录 有问题的欢迎交流 比较懒写博客





版权声明:本文为king4148原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。