2017-06-15 54 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无法检测到 –