Android 嵌套滚动视图+;AppBarLayout内容落后

Android 嵌套滚动视图+;AppBarLayout内容落后,android,dynamic,nestedscrollview,behind,Android,Dynamic,Nestedscrollview,Behind,我已经实现了一个类似的设计 一个可折叠的工具栏,当向下滚动时,其中有一个图像 <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.and

我已经实现了一个类似的设计

一个可折叠的工具栏,当向下滚动时,其中有一个图像

<android.support.design.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:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true">

        <android.support.design.widget.AppBarLayout
            android:id="@+id/app_bar_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:fitsSystemWindows="true"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

            <android.support.design.widget.CollapsingToolbarLayout
                android:id="@+id/collapsing_toolbar"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:fitsSystemWindows="true"
                app:contentScrim="?attr/colorPrimary"
                app:expandedTitleMarginEnd="64dp"
                app:expandedTitleMarginStart="48dp"
                app:layout_scrollFlags="scroll|exitUntilCollapsed">

                <android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
                    android:id="@+id/pager"
                    android:layout_width="match_parent"
                    android:layout_height="@dimen/picture_heigth"
                    android:fitsSystemWindows="true"
                    app:layout_collapseMode="parallax">

                </android.support.v4.view.ViewPager>


                <android.support.v7.widget.Toolbar
                    android:id="@+id/toolbar"
                    android:layout_width="match_parent"
                    android:layout_height="?attr/actionBarSize"
                    app:layout_collapseMode="pin"
                    app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />


            </android.support.design.widget.CollapsingToolbarLayout>
        </android.support.design.widget.AppBarLayout>

        <android.support.v4.widget.NestedScrollView
            android:id="@+id/scroll_view"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"         
            android:foreground="?android:windowContentOverlay"

            app:layout_behavior="@string/appbar_scrolling_view_behavior">
            LinearLayout
            android:id="@+id/root"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

线性布局
android:id=“@+id/root”
android:layout\u width=“匹配父项”
android:layout\u height=“match\u parent”
android:orientation=“vertical”>
它非常有效,但并不总是。。。例如,在线性布局中,我有一个视图,它在我的rest请求完成后被填充。这会将内容推到Viewpager后面,当我再次向下和向上滚动时,所有内容都会再次进入正确的位置

我在一些SO线程上看到,通过在NestedSCrollVew上设置“fill_vertical”,它解决了一些问题。实际上是这样的,内容并不落后,但是滚动视图的底部被剪切了。。。
通过添加一些底部边距,它解决了问题,但它是动态的,我不知道要添加什么边距…

添加到线性布局焦点属性:

        android:focusable="true"
        android:focusableInTouchMode="true"

一种解决方案是在
NestedScrollView
上设置填充,并将填充剪辑设置为false,如下所示:

android:paddingTop="?actionBarSize"
android:clipToPadding="false"

得到答案了吗?