2017-06-15 29 views
0

即時通訊在一個佈局中使用了兩個recyclerview,如果我想同時recylerview可以滾動,我添加了嵌套滾動視圖。如何處理滾動視圖緩慢Android

也許是這樣的:

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

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

    <RelativeLayout 
     android:id="@+id/xx" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content"> 

     <android.support.v7.widget.RecyclerView 
      android:id="@+id/arrayListUser" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentTop="true" 
      android:divider="@color/white"> 


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

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

     <View 
      android:layout_width="match_parent" 
      android:layout_height="1dp" 
      android:layout_marginLeft="3dp" 
      android:layout_marginRight="3dp" 
      android:background="@color/line"/> 

    </RelativeLayout> 
    <RelativeLayout 

     android:layout_width="wrap_content" 
     android:layout_height="match_parent"> 

     <android.support.v7.widget.RecyclerView 
      android:id="@+id/arrayList" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_alignParentTop="true" 
      android:divider="@color/white"> 


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

    </RelativeLayout> 

</LinearLayout> 

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

2 Recylerview在一個Nestedscrollview使緩慢滾動。那麼,如何處理以使其更快?

+0

請參閱此回答將幫助你: - https://stackoverflow.com/a/41956464/3946958 ..讓我知道在遇到問題 –

回答

0

設置setNestedScrollingEnabled到假

mRecyclerView.setNestedScrollingEnabled(false); 

以及在佈局

<android.support.v7.widget.RecyclerView 
     ... 
     android:nestedScrollingEnabled="false"/> 

哪些啓用或禁用嵌套滾動該視圖。

+0

不起作用,錯誤 –

+0

你得到什麼錯誤? – Sanoop

+0

NestedScrollview無法檢測到 –