使用Android中的RefreshLayout在ScrollView中未滚动完整视图

使用Android中的RefreshLayout在ScrollView中未滚动完整视图,android,xml,android-layout,Android,Xml,Android Layout,我有一个带有两个recyclerView的布局。我在第二个recyclerView中添加了SwiperFresh布局,当第二个recyclerView在末尾移动时将触发该布局。但是我看到完整的布局不会同时滚动。第二个回收器视图设置为栅格布局 我想要的是一个带有RecyclerView的产品类别部分,下面是另一个带有产品的RecyclerView。我想在产品上添加分页,因此我在产品上添加了一个新标签 下面是我尝试过的方法,但没有达到预期效果 <?xml version="1.0&q

我有一个带有两个recyclerView的布局。我在第二个recyclerView中添加了SwiperFresh布局,当第二个recyclerView在末尾移动时将触发该布局。但是我看到完整的布局不会同时滚动。第二个回收器视图设置为栅格布局

我想要的是一个带有RecyclerView的产品类别部分,下面是另一个带有产品的RecyclerView。我想在产品上添加分页,因此我在产品上添加了一个新标签

下面是我尝试过的方法,但没有达到预期效果

<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView 
    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:scrollbars="none"
    android:fillViewport="true"
    tools:context=".Buyer.PackageProductCategory.ProductCategoryDetailsActivity">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <ImageView
            android:id="@+id/back_"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="12dp"
            android:layout_marginTop="16dp"
            android:src="@drawable/ic_baseline_arrow_back_32"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <com.google.android.material.textview.MaterialTextView
            android:id="@+id/category_name"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="16dp"
            android:fontFamily="@font/rubik_medium"
            android:text="Electronics"
            android:textAllCaps="true"
            android:textAppearance="@style/TextAppearance.MaterialComponents.Headline6"
            app:layout_constraintBottom_toBottomOf="@id/back_"
            app:layout_constraintStart_toEndOf="@id/back_"
            app:layout_constraintTop_toTopOf="@id/back_" />

        <com.google.android.material.textview.MaterialTextView
            android:id="@+id/product_category_text"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="4dp"
            android:layout_marginTop="24dp"
            android:fontFamily="@font/rubik_medium"
            android:text="@string/explore_categories"
            android:textAppearance="@style/TextAppearance.AppCompat.Title"
            app:layout_constraintStart_toStartOf="@+id/back_"
            app:layout_constraintTop_toBottomOf="@id/back_" />

        <!-- Grid View -->
        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/secondary_category_recycler_view"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="@+id/product_category_text"
            app:layout_constraintTop_toBottomOf="@id/product_category_text" />


        <!-- Grid View -->
        <com.google.android.material.textview.MaterialTextView
            android:id="@+id/products_text"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="4dp"
            android:layout_marginTop="16dp"
            android:fontFamily="@font/rubik_medium"
            android:text="@string/explore_products"
            android:textAppearance="@style/TextAppearance.AppCompat.Title"
            app:layout_constraintStart_toStartOf="@+id/back_"
            app:layout_constraintTop_toBottomOf="@id/secondary_category_recycler_view" />


        <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
            android:id="@+id/swipeRefresh"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_marginTop="8dp"
            android:layout_marginBottom="8dp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="@id/products_text"
            app:layout_constraintTop_toBottomOf="@id/products_text">

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/mixed_products"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />
        </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

        <ProgressBar
            android:id="@+id/loading_mixed_products_data"
            android:layout_width="74dp"
            android:layout_height="74dp"
            android:layout_marginTop="48dp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="@id/products_text"
            app:layout_constraintTop_toBottomOf="@id/products_text" />

        <com.google.android.material.button.MaterialButton
            android:id="@+id/not_found_button_continue"
            style="@style/DefaultButtonStyle"
            android:layout_marginTop="8dp"
            android:backgroundTint="@color/material_red_500"
            android:text="Try Again"
            android:visibility="gone"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/no_products_in_this_category_text" />

        <com.google.android.material.textview.MaterialTextView
            android:id="@+id/no_products_in_this_category_text"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:ellipsize="end"
            android:fontFamily="@font/rubik"
            android:gravity="center_horizontal"
            android:maxLines="2"
            android:padding="8dp"
            android:paddingTop="12dp"
            android:text="@string/sorry_no_products_in_this_category_yet_near_your_location_please_check_back_later"
            android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle1"
            android:visibility="gone"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/loading_mixed_products_data" />


    </androidx.constraintlayout.widget.ConstraintLayout>

</androidx.core.widget.NestedScrollView>