Android:在任务列表隐藏最近打开的app


对于某一个应用,如果不想在最近打开的app列表中留下任何纪录,即按下Home键回到主页,再按任务键的时候,任务列表看不到这个app,在AndroidManifest中给Activity标签添加:android:excludeFromRecents=”true”即可。

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.li.test" android:versionCode="1" android:versionName="1.0">

    <uses-sdk  android:minSdkVersion="14" android:targetSdkVersion="23" />

    <application  android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme">

        <activity android:name=".MainActivity" android:excludeFromRecents="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

设置之后,按Home键,回到主页面。点击任务键,显示“无最近使用的应用程序”。如下图所示:
无最近使用的应用程序


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM