我有一个CoordinatorLayout
,其中具有AppBarLayout
(包含CollapsingToolbarLayout
),RecyclerView,并在其下方有一个ImageView
。我面临的问题是CoordinatorLayout
在ImageView
下方添加了一些多余的空间,该空间不应出现在UI中。
下面是我的XML的代码
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
......
</com.google.android.material.appbar.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/myRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<ImageView
android:id="@+id/myImage"
android:layout_width="match_parent"
android:layout_height="100dp"
android:contentDescription="@null"
android:scaleType="fitXY"
android:src="@drawable/static_image" />
</LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>