简体   繁体   English

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

[英]When not collapsed some part of the the toolbar is visible over the ImageView of CollapsingToolbarLayout

The CollapsingToolbarView works perfectly fine, but there is this unwanted strip on the ImageView of the collapsing toolbar. CollapsingToolbarView工作得很好,但在折叠工具栏的ImageView上有这个不需要的条带。

As you can see below there is a red strip (possibly toolbar) after the status bar. 如下所示,状态栏后面有一个红色条带(可能是工具栏)。 How do I get rid of it? 我怎么摆脱它?

screenshot1 screenshot2

Below is the relevant xml file: 以下是相关的xml文件:

fragment_movie.xml fragment_movie.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>

The theme for the parent activity is set as "@style/AppTheme.NoActionBar" in the Manifest. 父活动的主题在Manifest中设置为"@style/AppTheme.NoActionBar"

android:fitsSystemWindows="true"应该在CoordinatorLayoutAppBarLayoutCollapsingToolbarLayout和它内部的ImageView

Try removing adjustViewBounds attribute from image. 尝试从图像中删除adjustViewBounds属性。 You're using centerCrop which should be enough for image to show properly and fill all space. 您正在使用centerCrop,它应足以使图像正确显示并填充所有空间。 By adjusting view bounds you're preserving aspect ratio, so the image doesn't fill the app bar space. 通过调整视图边界,您可以保留纵横比,因此图像不会填充应用栏空间。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 即使 CollapsingToolbarLayout 折叠,如何使 Toolbar 和 TabLayout 仍然可见? - How to make Toolbar and TabLayout still visible even when CollapsingToolbarLayout is collapsed? 在CollapsingToolbarLayout中,工具栏在折叠状态下不可见 - Toolbar not visible in collapsed state inside CollapsingToolbarLayout CollapsingToolbarLayout折叠时未显示工具栏标题 - Toolbar Title not showing when CollapsingToolbarLayout collapsed 当CollapsingToolbarLayout折叠时,工具栏HOME不起作用 - Toolbar HOME not working when CollapsingToolbarLayout collapsed CollapsingToolbarLayout - 展开时隐藏 ImageView,折叠时显示 - CollapsingToolbarLayout - Hide ImageView when Expanded, show when Collapsed 当CollapsingToolbarLayout折叠时,锚定图像会被工具栏重叠 - Anchor image gets overlapped by toolbar when CollapsingToolbarLayout is collapsed 如何将RecyclerView放在CollapsingToolbarLayout下面并在Android中折叠时响应工具栏? - How to put RecyclerView below CollapsingToolbarLayout and responsive to toolbar when collapsed in Android? 在 CollapsingToolbarLayout 中折叠时如何删除透明的工具栏填充 - How to remove transparent Toolbar padding when collapsed in CollapsingToolbarLayout 如何将CollapsingToolbarLayout的背景保留为ToolBar的背景,即使在折叠时也是如此 - How to keep the background of CollapsingToolbarLayout as the background of ToolBar even when collapsed 在工具栏上覆盖imageview的一部分 - Overlay part of an imageview over toolbar
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM