CollapsingToolbarView 工作得很好,但折叠工具栏的 ImageView 上有这个不需要的 strip 。
正如您在下面看到的,状态栏后面有一个红色 strip (可能是工具栏)。我该如何摆脱它?
下面是相关的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"
应该在 CoordinatorLayout
、AppBarLayout
、CollapsingToolbarLayout
和ImageView
在里面。
关于android - 当未折叠时,工具栏的某些部分在 CollapsingToolbarLayout 的 ImageView 上可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37098519/