There is only one toolbar in my project, surrounded by AppBarLayout, and also underneath it is the NestedScrollView control, which has a CardView layout with a linear layering. there is no problem that the nested scroll overlaps the toolbar as shown in the picture

and also at runtime it passes the application, for example, there is no such toolbar:


this is my code:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app= "http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<android.support.design.widget.AppBarLayout
android:id="@+id/appbarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:elevation="7dp"
app:theme="@style/ThemeOverlay.AppCompat"
android:popupTheme="@style/ThemeOverlay.AppCompat.Light"
android:titleTextColor="@color/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
></android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:nestedScrollingEnabled="true"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingTop="10dp"
>
<include layout="@layout/scroll_view_item" />
<include layout="@layout/scroll_view_item" />
<include layout="@layout/scroll_view_item" />
<include layout="@layout/scroll_view_item" />
<include layout="@layout/scroll_view_item" />
<include layout="@layout/scroll_view_item" />
<include layout="@layout/scroll_view_item" />
<include layout="@layout/scroll_view_item" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
scroll_view_item code is here:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:elevation="5dp"
app:cardCornerRadius="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:orientation="vertical"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Dummy Header"
android:textColor="@android:color/holo_red_light"
android:textSize="20sp"
android:textStyle="bold"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="@string/app_text"
/>
</LinearLayout>
</android.support.v7.widget.CardView>
source
share