当使用AppBarLayout与标准ScrollingViewBehavior ,该AppBarLayout的兄弟姐妹会被默认的CoordinatorLayout和兄弟姐妹的底部的高度将由AppBarLayout的高度屏幕之外。
在我的用例中, NestedScrollView只是允许工具栏折叠的一种工具,同时在可折叠工具栏下方显示另一个可滚动视图(在这种情况下为碎片)。 片段是包含固定视图的片段(在这种情况下为FAB)
下面的图片演示了我正在描述的问题,提供的代码是导致问题的基本XML。
android:id="@+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways" />
android:id="@+id/nestedScrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
android:id="@+id/fragmentHolder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">