2017-07-03 99 views
0

enter image description here如何滚动RecyclerView滚动型

如何滚动以上所有RecyclerView滚动型

我在滚动视图实现RecyclerView ahow为波纹管的代码,而不是滚动RecyclerView。

请给答案

  <ScrollView 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_below="@+id/horizontalScrollView" 
      android:layout_marginTop="10dp"> 

      <RelativeLayout... 

         <android.support.v7.widget.RecyclerView 
          android:id="@+id/rvpouch" 
          android:layout_width="match_parent" 
          android:layout_height="match_parent" 
          android:nestedScrollingEnabled="false" 
          android:layout_below="@+id/textView3"> 


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

        </RelativeLayout> 

     </ScrollView> 
+0

嵌套滚动查看是不是一个好主意。 –

+0

尝试使用“ScrollView”里面使用“LinearLayout”和里面把你所有的“RecyclerView”.........可能是它的工作 –

回答

0

使用NestedScrollView而不是滚动视图,并设置

recyclerView.setNestedScrollingEnabled(false); 
+0

上面的代码不work.whole scrollview滚动如果滚动 –

+0

你真正想要什么,我想你想要滚动多个recyclerview和一些recyclerview水平 –

3

不要使用RecyclerViewScrollView。使用NestedScrollView而不是ScrollView

NestedScrollView就像ScrollView,但它支持作用 既是一个嵌套的滚动父母和孩子在新的和旧 Android版本。嵌套滚动默认启用。

例如:

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

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

     <android.support.v7.widget.RecyclerView 
      android:id="@+id/recyclerView_one" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:nestedScrollingEnabled="false"> 

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

     <android.support.v7.widget.RecyclerView 
      android:id="@+id/recyclerView_two" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:nestedScrollingEnabled="false"> 

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

     <android.support.v7.widget.RecyclerView 
      android:id="@+id/recyclerView_three" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:nestedScrollingEnabled="false"> 

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

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

为平滑滚动使用属性android:nestedScrollingEnabled="false"

+0

上面的代码不work.whole滚动视图滚动如果滚动 –

+0

张贴您当前布局xml。 – FAT

+0

它看起来像你的文章主要是代码;请添加更多的细节。 –

0

下面的代码片段将帮助您使用ScrollViewRecyclerView

<ScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:scrollbarSize="3dp" 
    android:scrollbarThumbVertical="@drawable/scrollbar_black"> 

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

     <RelativeLayout 
      android:id="@+id/rlFiltersSearchEvent" 
      android:layout_width="match_parent" 
      android:layout_height="250dp" 
      android:background="@drawable/action_bar_gradient"> 

     </RelativeLayout> 

     <android.support.v7.widget.RecyclerView 
      android:id="@+id/rvListOfEventsMain" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:padding="@dimen/fab_margin" 
      android:layout_below="@+id/rlFiltersSearchEvent" 
      android:nestedScrollingEnabled="false" 
      android:scrollbars="none" /> 

    </RelativeLayout> 
</ScrollView> 

来实现滚动希望它可以帮助