Android:在任務列表隱藏最近打開的app

對於某一個應用,若是不想在最近打開的app列表中留下任何紀錄,即按下Home鍵回到主頁,再按任務鍵的時候,任務列表看不到這個app,在AndroidManifest中給Activity標籤添加:android:excludeFromRecents=」true」便可。android

<?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鍵,回到主頁面。點擊任務鍵,顯示「無最近使用的應用程序」。以下圖所示:
無最近使用的應用程序web

相關文章
相關標籤/搜索