Android 折叠工具栏布局在折叠时禁用背景

Android 折叠工具栏布局在折叠时禁用背景,android,android-layout,android-collapsingtoolbarlayout,Android,Android Layout,Android Collapsingtoolbarlayout,我将依赖项更新为v24,但现在我的折叠工具栏布局已损坏。当用户还没有滚动时,我用它来显示一个图像(使用setBackground),之后它会变成蓝色。现在它一直显示图像,下面有一个白色条,覆盖了我的内容,但我的代码中没有任何更改。这是一张图片(故意将背景改为红色):。 看到工具栏上有图像而不是纯色吗?还可以看到标题被工具栏下的红色条截断。以下是布局(只是从android studio模板编辑的布局): <android.support.design.widget.AppBarLa

我将依赖项更新为v24,但现在我的折叠工具栏布局已损坏。当用户还没有滚动时,我用它来显示一个图像(使用setBackground),之后它会变成蓝色。现在它一直显示图像,下面有一个白色条,覆盖了我的内容,但我的代码中没有任何更改。这是一张图片(故意将背景改为红色):。 看到工具栏上有图像而不是纯色吗?还可以看到标题被工具栏下的红色条截断。以下是布局(只是从android studio模板编辑的布局):

    <android.support.design.widget.AppBarLayout
        android:id="@+id/viewarticle_appbarlayout"
        android:layout_width="match_parent"
        android:layout_height="@dimen/app_bar_height"
        android:fitsSystemWindows="true"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/article_collapsingtoolbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            app:contentScrim="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_collapseMode="pin"
                app:popupTheme="@style/AppTheme.PopupOverlay" />

        </android.support.design.widget.CollapsingToolbarLayout>
    </android.support.design.widget.AppBarLayout>

    <include layout="@layout/content_view_article" />

</android.support.design.widget.CoordinatorLayout>
</android.support.v4.widget.NestedScrollView>

content\u view\u article.xml

    <android.support.design.widget.AppBarLayout
        android:id="@+id/viewarticle_appbarlayout"
        android:layout_width="match_parent"
        android:layout_height="@dimen/app_bar_height"
        android:fitsSystemWindows="true"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/article_collapsingtoolbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            app:contentScrim="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_collapseMode="pin"
                app:popupTheme="@style/AppTheme.PopupOverlay" />

        </android.support.design.widget.CollapsingToolbarLayout>
    </android.support.design.widget.AppBarLayout>

    <include layout="@layout/content_view_article" />

</android.support.design.widget.CoordinatorLayout>
</android.support.v4.widget.NestedScrollView>


编辑:我正在使用支持库的V24.0.3,我将所有内容更新为24.2.1,不可见条消失了。背景问题仍然存在,尽管

删除你的工具栏,你不需要它。@HAXM如果我删除它,那么我就看不到工具栏,但我提到的工具栏仍然在根据你的需要更改appbar布局高度,最好它应该等于toolbar@HAXM这只会使折叠布局不会折叠,此外,不可见条仍在更新为24.2.1我的所有依赖项我修复了不可见条问题。当工具栏折叠时,背景仍然保留,这不应该发生,因为我有app:contentScrimremove工具栏,你不需要它。@HAXM如果我移除它,那么我就看不到工具栏,但是我提到的工具栏仍然在那里,根据你的需要更改appbar布局高度,最好它应该等于toolbar@HAXM这只会使折叠布局不会折叠,而且不可见条仍会因此更新为24.2.1我的所有依赖项我修复了不可见条问题。但当该条折叠时,背景仍然存在,这不应该发生,因为我有app:contentScrim
    <android.support.design.widget.AppBarLayout
        android:id="@+id/viewarticle_appbarlayout"
        android:layout_width="match_parent"
        android:layout_height="@dimen/app_bar_height"
        android:fitsSystemWindows="true"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/article_collapsingtoolbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            app:contentScrim="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_collapseMode="pin"
                app:popupTheme="@style/AppTheme.PopupOverlay" />

        </android.support.design.widget.CollapsingToolbarLayout>
    </android.support.design.widget.AppBarLayout>

    <include layout="@layout/content_view_article" />

</android.support.design.widget.CoordinatorLayout>
</android.support.v4.widget.NestedScrollView>