android - 当未折叠时,工具栏的某些部分在 CollapsingToolbarLayout 的 ImageView 上可见

标签 android xml android-layout android-coordinatorlayout android-collapsingtoolbarlayout

CollapsingToolbarView 工作得很好,但折叠工具栏的 ImageView 上有这个不需要的 strip 。

正如您在下面看到的,状态栏后面有一个红色 strip (可能是工具栏)。我该如何摆脱它?

screenshot1 screenshot2

下面是相关的xml文件:

fragment _电影.xml

<android.support.design.widget.CoordinatorLayout
    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:layout_height="match_parent"
    android:layout_width="match_parent"
    android:fitsSystemWindows="true"
    tools:context="com.jayeshsolanki.mmdb.ui.fragment.MovieFragment">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recyclerview_movie"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"/>

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <android.support.design.widget.CollapsingToolbarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_scrollFlags="scroll|exitUntilCollapsed"
            app:contentScrim="?attr/colorPrimaryDark"
            app:title="@string/placeholder_movie_item_title">

            <ImageView
                android:id="@+id/backdrop_movie"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:scaleType="centerCrop"
                android:adjustViewBounds="true"
                app:layout_collapseMode="parallax"
                tools:src="@drawable/placeholder_movie_item_backdrop"/>

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

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

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

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

父 Activity 的主题在 list 中设置为 "@style/AppTheme.NoActionBar"

最佳答案

android:fitsSystemWindows="true" 应该在 CoordinatorLayoutAppBarLayoutCollapsingToolbarLayoutImageView 在里面。

关于android - 当未折叠时,工具栏的某些部分在 CollapsingToolbarLayout 的 ImageView 上可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37098519/

相关文章:

xml - 亚马逊产品 API : ItemLookup with Multiple ASINs

android - 我无法从我的应用程序中的包中获取数据

Android 应用程序在启动时崩溃

android - 如何保存和恢复android WebView的WebBackForwardList?

xml - 使用 LibXML 和 XPath 查找带冒号的节点(本地命名空间)

javascript - 在 IE9 而不是 Chrome 中使用 jQuery 解析 XML 时缺少 innerHTML

android - 如何使 ListView (已创建)可点击(Android)?

android - 在 SD 卡上分发 Android 应用程序

android - 仅在全屏模式下打开键盘布局调整大小

xml - android的xml中的梯形阴影