Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/367.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 列表页面回收视图无限滚动在放入NestedScrollView时不工作_Java_Android Recyclerview_Infinite Scroll_Android Nestedscrollview - Fatal编程技术网

Java 列表页面回收视图无限滚动在放入NestedScrollView时不工作

Java 列表页面回收视图无限滚动在放入NestedScrollView时不工作,java,android-recyclerview,infinite-scroll,android-nestedscrollview,Java,Android Recyclerview,Infinite Scroll,Android Nestedscrollview,我使用了两个recyclerviews,因为我必须显示两个列表,其中一个是水平列表,另一个是垂直列表,具有无限滚动,对于两个列表的滚动,我已将它们添加到nestedScrollView中,但垂直列表的无限滚动不起作用,当我向下滚动时,在第一次加载项之后有一个分页逻辑,然后调用api,然后在列表中加载项 <android.support.v4.widget.NestedScrollView android:id="@+id/scrollView" android:layout

我使用了两个recyclerviews,因为我必须显示两个列表,其中一个是水平列表,另一个是垂直列表,具有无限滚动,对于两个列表的滚动,我已将它们添加到nestedScrollView中,但垂直列表的无限滚动不起作用,当我向下滚动时,在第一次加载项之后有一个分页逻辑,然后调用api,然后在列表中加载项

<android.support.v4.widget.NestedScrollView
    android:id="@+id/scrollView"
    android:layout_width="match_parent"
    android:layout_height="match_parent">


    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">


        <LinearLayout
            android:id="@+id/llRecentlyBought"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentStart="true"
            android:layout_alignParentTop="true"
            android:orientation="vertical"
            android:visibility="gone"
            app:layout_behavior="@string/appbar_scrolling_view_behavior">

            <TextView
                android:id="@+id/txtVRecentlyBought"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/bg_grey_color"
                android:padding="10dp"
                android:text="@string/recently_bought"
                android:textSize="@dimen/font_s_ize_levelone_signup" />

            <android.support.v7.widget.RecyclerView
                android:id="@+id/recyclerRecentlyBought"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:nestedScrollingEnabled="false"
                android:paddingStart="@dimen/padding_home_1"
                android:paddingEnd="@dimen/padding_home_1"
                android:scrollbars="none"
                android:focusable="false"
                android:focusableInTouchMode="true"
                app:layout_behavior="@string/appbar_scrolling_view_behavior" />

            </LinearLayout>


            <android.support.v7.widget.RecyclerView
                android:id="@+id/products_in_gridView"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_below="@+id/llRecentlyBought"
                android:layout_alignParentStart="true"
                android:layout_gravity="top"
                android:layout_marginTop="5dp"
                android:background="@android:color/white"
                android:descendantFocusability="blocksDescendants"
                android:fadingEdge="none"
                android:paddingStart="@dimen/padding_home_1"
                android:paddingEnd="@dimen/padding_home_1"
                android:paddingBottom="@dimen/padding_home_1"
                android:scrollbars="none"
                android:focusable="false"
                android:focusableInTouchMode="true"    
                app:layout_behavior="@string/appbar_scrolling_view_behavior"/>

           </RelativeLayout>

    </android.support.v4.widget.NestedScrollView>







BaseAttacher mBaseAttacher = Mugen.with(productsInGridRecyclerView, new MugenCallbacks() {
            @Override
            public void onLoadMore() {
                if (indexOfCurrentPage < TOTAL_PAGE_AVAILABLE) {
                    indexOfCurrentPage += 1;
                    // loadNextPage(indexOfCurrentPage);


                    if (isLastPage == false) {
                        loadNextPage(indexOfCurrentPage);
                    } else if (isLastPage == true) {
                        //   Toast.makeText(getActivity(), "No more products", Toast.LENGTH_SHORT).show();
                        Toast.makeText(getActivity(), getResources().getString(R.string.txt_no_product_found), Toast.LENGTH_SHORT).show();
                    }

                }
            }

            @Override
            public boolean isLoading() {
                return isLoading;
            }

            @Override
            public boolean hasLoadedAllItems() {
                return false;
            }
        }).

                start();
        mBaseAttacher.setLoadMoreEnabled(true);
        mBaseAttacher.setLoadMoreOffset(2);

无需nestedscrollview 我刚刚将app:layout\u behavior=“@string/appbar\u scrolling\u view\u behavior”添加到父布局中
它起作用了

不需要nestedscrollview 我刚刚将app:layout\u behavior=“@string/appbar\u scrolling\u view\u behavior”添加到父布局中 它起作用了