未折叠时,工具栏的某些部分在CollapsingToolbarLayout的ImageView上可见 [英] When not collapsed some part of the the toolbar is visible over the ImageView of CollapsingToolbarLayout

本文介绍了未折叠时,工具栏的某些部分在CollapsingToolbarLayout的ImageView上可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CollapsingToolbarView可以很好地工作,但是在折叠工具栏的ImageView上有不需要的条纹.

The CollapsingToolbarView works perfectly fine, but there is this unwanted strip on the ImageView of the collapsing toolbar.

您可以在下面看到,状态栏后面有一个红色的条带(可能是工具栏).我如何摆脱它?

As you can see below there is a red strip (possibly toolbar) after the status bar. How do I get rid of it?

   

     

下面是相关的xml文件:

Below is the relevant xml file:

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>

父活动的主题在清单中设置为"@style/AppTheme.NoActionBar".

The theme for the parent activity is set as "@style/AppTheme.NoActionBar" in the Manifest.

推荐答案

android:fitsSystemWindows="true"应该位于其中的CoordinatorLayoutAppBarLayoutCollapsingToolbarLayoutImageView上.

android:fitsSystemWindows="true" is supposed to be on CoordinatorLayout, AppBarLayout, CollapsingToolbarLayout and the ImageView inside it.

这篇关于未折叠时,工具栏的某些部分在CollapsingToolbarLayout的ImageView上可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆