SwipeRefreshLayout загораживает ToolBar

Я хочу добавить SwipeRefreshLayout, чтобы обновлять информацию в RecycleView, однако он игнорирует Toolbar и загораживает его. Использую ConstraintLayout. Вот мой код:

    <?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"
        tools:context=".MainActivity">

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:background="@color/colorPrimary"
            android:theme="@style/Theme.AppCompat.DayNight.NoActionBar"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.0"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent">

            <Spinner
                android:id="@+id/spinnerSort"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:entries="@array/sortTypes"
                android:gravity="end"
                app:layout_constraintBottom_toBottomOf="@+id/toolbar"
                app:layout_constraintEnd_toEndOf="@+id/toolbar"
                app:layout_constraintTop_toTopOf="@+id/toolbar" />
        </androidx.appcompat.widget.Toolbar>


        <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
            android:id="@+id/swipe_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/toolbar">

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/recyclerViewPosters"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/toolbar" />
        </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>



</androidx.constraintlayout.widget.ConstraintLayout>

Ответы (0 шт):