关键点:
如果在 AppBarLayout 添加了 android:fitsSystemWindows="true"属性,就会保留titbar的高度
<android.support.design.widget.CoordinatorLayout
android:layout_width=“match_parent”
android:layout_height=“match_parent”>
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:background="@color/white"
app:elevation="0dp">
需要滑动的view
</LinearLayout>
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+idnamicFragmentRootView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
</FrameLayout>
</android.support.design.widget.CoordinatorLayout>