Android CoordinatorLayout(带AppBarLayout)内部视图寻呼机内部CoordinatorLayout

Android CoordinatorLayout(带AppBarLayout)内部视图寻呼机内部CoordinatorLayout,android,android-coordinatorlayout,android-appbarlayout,Android,Android Coordinatorlayout,Android Appbarlayout,因此,我的根活动布局(带有CoordinatorLayout、ToolbarLayout、Viewpager)如下所示: 在我的一个ViewPager片段中,我有如下布局 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:

因此,我的根活动布局(带有CoordinatorLayout、ToolbarLayout、Viewpager)如下所示:


在我的一个ViewPager片段中,我有如下布局

<LinearLayout 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:layout_width="match_parent"
              android:layout_height="match_parent"
              android:background="@color/white"
              android:orientation="vertical"
              tools:ignore="MissingPrefix">

    <LinearLayout
        android:id="@+id/fixedContent"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center_vertical">

        <!-- SOME FIXED CONTENT -->
    </LinearLayout>

    <android.support.design.widget.CoordinatorLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1">


        <android.support.v7.widget.RecyclerView
            android:id="@+id/list"
            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/appBarLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#f5f5f5">

            <FrameLayout
                android:id="@+id/content"
                android:layout_width="match_parent"
                android:layout_height="360dp"
                android:minHeight="100dp"
                app:layout_scrollFlags="scroll|exitUntilCollapsed">

                <!-- SOME CONTENT THAT CHANGES W/ THE APPBAR OFFSET -->
            </FrameLayout>
        </android.support.design.widget.AppBarLayout>
    </android.support.design.widget.CoordinatorLayout>

</LinearLayout>

我遇到的问题是,当RecyclerView向上滚动时,只有它的兄弟AppBarLayout的大小发生了变化,而它的祖先父AppBarLayout(持有工具栏)从未被调整过——实际上我们希望它是第一个被调整的视图


有人对如何解决这个问题有什么建议吗?

也许您需要片段协调布局作为根视图,而不是线性布局。您找到这个了吗?这是第二次有人问这个问题,而且没有关于如何处理嵌套问题的正式文件CoordinatorLayouts@Atieh据我所知,不支持嵌套的Coordinator布局,观察到实现了NestedScrollingParent,但没有实现NestedScrollingChild。我的解决方案是通过收听RecyclerView滚动并调整叠加视图来实现所需的行为。(所以只有一个最高级别的协调人)kassim,你能分享一下你最终做了什么吗?
<LinearLayout 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:layout_width="match_parent"
              android:layout_height="match_parent"
              android:background="@color/white"
              android:orientation="vertical"
              tools:ignore="MissingPrefix">

    <LinearLayout
        android:id="@+id/fixedContent"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center_vertical">

        <!-- SOME FIXED CONTENT -->
    </LinearLayout>

    <android.support.design.widget.CoordinatorLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1">


        <android.support.v7.widget.RecyclerView
            android:id="@+id/list"
            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/appBarLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#f5f5f5">

            <FrameLayout
                android:id="@+id/content"
                android:layout_width="match_parent"
                android:layout_height="360dp"
                android:minHeight="100dp"
                app:layout_scrollFlags="scroll|exitUntilCollapsed">

                <!-- SOME CONTENT THAT CHANGES W/ THE APPBAR OFFSET -->
            </FrameLayout>
        </android.support.design.widget.AppBarLayout>
    </android.support.design.widget.CoordinatorLayout>

</LinearLayout>