2017-07-03 5 views
0

enter image description herewie RecyclerView blättern in Scrollview

wie in Scrollview

i RecyclerView in Scrollview AWie als Gebrüll Code implementieren haben alle oben RecyclerView blättern, aber nicht RecyclerView blättern.

bitte geben Antwort

  <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

Nesting scrollbaren Ansichten hilft, ist nie eine gute Idee. –

+0

versuchen, "ScrollView" innerhalb dieser verwenden "LinearLayout" und innen setzen Sie alle Ihre "RecyclerView" ......... kann ihre Arbeit sein –

Antwort

0

Verwenden NestedScrollView statt blättern Ansicht und setzen

recyclerView.setNestedScrollingEnabled(false); 
+0

über Code nicht work.whole scrollview scroll wenn scroll –

+0

was Sie genau wollen , ich denke, dass Sie Scroll mehrere recyclingview und einige recyclerview horizontal –

3

nicht RecyclerView innen ScrollView anwenden. Verwenden Sie NestedScrollView anstelle von ScrollView.

NestedScrollView ist wie ScrollView, aber es unterstützt sowohl als verschachtelte Scrollen Eltern und Kind auf den neuen und alten Versionen von Android handeln. Verschachteltes Scrollen ist standardmäßig aktiviert.

Beispiel:

<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> 

Verwendungs-Attribut android:nestedScrollingEnabled="false" für glatte Scrollen.

+0

über den Code nicht arbeiten möchten.whole scrollview scroll wenn scroll –

+0

Sie aktuelle Layout xml. – FAT

+0

sieht es so aus, als ob dein Beitrag hauptsächlich aus Code besteht; Bitte fügen Sie weitere Details hinzu. –

0

folgende Code-Schnipsel wird Ihnen helfen, eine Rolle im ScrollView von RecyclerView

<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> 

Hoffnung mit implementieren es

Verwandte Themen