[英]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?
我怎么摆脱它?
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"
应该在CoordinatorLayout
, AppBarLayout
, CollapsingToolbarLayout
和它内部的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.