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