android 任务管理器中的应用程序闪烁

App flickers in android task manager

我最近注意到当我的应用出现在 android "task manager" 中时会出现奇怪的闪烁。

activity 好像是在导航栏上面画了一小段时间,然后又推回去了。 打开其他应用程序时,我的应用程序出现在所有其他应用程序的前面,"flickers" 后面。

以下是一些截屏视频:

我的 activity_main.xml 布局文件实现了一个简单的导航抽屉,其中空 FrameLayout 被当前片段替换:

<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"

    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    android:background="@color/background_material_light"
    tools:context=".MainActivity">

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <FrameLayout
            android:id="@+id/fragment_container_main"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="false" />

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="?attr/colorPrimary"
            android:minHeight="?attr/actionBarSize"
            android:theme="@style/Widget.AppTheme.Toolbar"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

    </FrameLayout>

    <ScrimInsetsFrameLayout
        android:id="@+id/navigation_drawer_container"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        android:layout_gravity="start"
        android:background="?android:attr/colorBackground"
        app:insetForeground="@color/insetsForeground">

        <android.support.v7.widget.RecyclerView
            android:id="@+id/navigation_drawer_list"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:choiceMode="singleChoice"
            android:scrollbars="vertical"
            android:divider="@null"
            android:dividerHeight="0dp"
            tools:context="NavDrawerAdapter" />

    </ScrimInsetsFrameLayout>

</android.support.v4.widget.DrawerLayout>

有没有人遇到过这个问题并且知道如何解决? 谢谢:)

好的,我刚刚发现问题所在。这是因为我的 window 背景在我的应用程序主题中被设置为 @android:color/transparent

不知何故,这使得整个 activity 在任务管理器中消失了。