Toolbar в AppBarLayout накладывается на содержимое вместо смещения контента
Есть 2 фрагмента, один из них имеет родительский контейнер AppBarLayout с Toolbar внутри, другой - Constraint Layout. Мне нужно, чтобы после добавления второго фрагмента учитывалось динамическое изменение размера первого фрагмента (с AppBarLayout) и происходило смещение, если размер первого увеличивается (список). Но по итогу один фрагмент перекрывает второй или наоборот, в зависимости от значения параметра app:layout_behavior у AppBarLayout. Не нашёл значения для параметра, когда вместо накладывания происходит смещение. Возможно, ранее уже так делал, но не вспомню, как именно. Спасибо!
Содержимое первого фрагмента:
<com.google.android.material.appbar.AppBarLayout 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="wrap_content"
android:visibility="visible"
android:background="@color/white">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/toolbarTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:text="@string/create_route"
android:textColor="#212121"
android:textSize="15sp" />
</androidx.appcompat.widget.Toolbar>
<View
android:id="@+id/dividerSearch"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#ECECEC"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/toolbar"
tools:ignore="NotSibling" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/infoList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/infoList"/>
Содержимое второго фрагмента:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:clickable="true"
android:focusable="true"
android:orientation="vertical">
<LinearLayout
....
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
Оба в контейнере
<FrameLayout
android:id="@+id/mainContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"/>