解決辦法:ide
一、在基類Activity中 添加方法this
@Override public boolean moveTaskToBack(boolean nonRoot) { return super.moveTaskToBack(nonRoot); }
二、在程序啓動頁Activity的onCreate()方法spa
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (!this.isTaskRoot()) { Intent mainIntent = getIntent(); String action = mainIntent.getAction(); if (mainIntent.hasCategory(Intent.CATEGORY_LAUNCHER) && Intent.ACTION_MAIN.equals(action)) { finish(); return; } } }