0

我有两个recycleView在相同的布局中,SwipeRefresher一个用于正常结果,另一个用于VIP,它也可以正常工作,但是VIP回收高于结果回收,这给了我一个有线结果。

滚动正常结果时,屏幕显示 VIP。

如何通过一次滚动行为进行两次回收?

我的布局如下所示:-

 <android.support.v4.widget.SwipeRefreshLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/swipeRefreshLayout"
    >
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">
    <android.support.v7.widget.RecyclerView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/vipRecycleView"/>
    <android.support.v7.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/resultRecycleView"
        >

    </android.support.v7.widget.RecyclerView>
    </LinearLayout>

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

下图展示了我目前的雕像。

在此处输入图像描述

4

2 回答 2

0

尝试

recyclerView.setNestedScrollingEnabled(true)

主要的 xml

 <android.support.v4.widget.SwipeRefreshLayout 
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:orientation="vertical" 
 android:layout_width="match_parent"
 android:layout_height="match_parent">

 <android.support.v7.widget.RecyclerView
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>

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

回收项目

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.v7.widget.RecyclerView
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>

</LinearLayout>
于 2017-09-12T07:49:07.623 回答
0

使用NestedScrollView并将两者都RecyclerView放入其中

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

    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <android.support.v7.widget.RecyclerView
                android:id="@+id/vipRecycleView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

            <android.support.v7.widget.RecyclerView
                android:id="@+id/resultRecycleView"
                android:layout_width="match_parent"
                android:layout_height="match_parent">

            </android.support.v7.widget.RecyclerView>
        </LinearLayout>
    </android.support.v4.widget.NestedScrollView>
</android.support.v4.widget.SwipeRefreshLayout>
于 2017-09-12T08:25:46.900 回答