0

如何在NestedScrollView中使用RecyclerView?设置适配器后,RecyclerView内容不可见。如果在NestedScrollView中使用RecyclerView,RecycleView在Android中设置NestedScrollView时不可见?

反正,我已经与内NestedScrollView RecyclerView通过添加喜欢的FrameLayout或RelativeLayout的一个作为的ViewGroup的nestedscrollview一个孩子尝试,然后我加了一个recyclerview内的FrameLayout或RelativeLayout的)提前

谢谢...

<android.support.design.widget.CoordinatorLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@color/colorWhite"> 

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

      <android.support.v4.widget.NestedScrollView 
       android:id="@+id/nestedView" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/appbar" 
       android:fillViewport="true"         
       app:layout_behavior="@string/appbar_scrolling_view_behavior"> 

       <LinearLayout 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:background="@drawable/profile_bg_clound" 
        android:orientation="vertical"> 

        <RelativeLayout 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_marginBottom="5dp" 
         android:layout_marginLeft="15dp" 
         android:layout_marginRight="15dp" 
         android:layout_marginTop="5dp"> 

         <android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" 
          android:id="@+id/swipe_refresh_layout" 
          android:layout_width="match_parent" 
          android:layout_height="wrap_content"> 


          <android.support.v7.widget.RecyclerView 
           android:id="@+id/rv_driverRequests" 
           android:layout_width="match_parent" 
           android:layout_height="wrap_content" 
           android:orientation="horizontal" 
           app:layout_behavior="@string/appbar_scrolling_view_behavior" /> 

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


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



     </RelativeLayout> 


    </android.support.design.widget.CoordinatorLayout> 

回答

-2

替换这是你的RecycleView ...

<com.app.view.CustomRecyclerView 
     android:id="@+id/rv_driverRequests" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal" 
     android:fillViewport="true" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" /> 

希望这会工作。

+0

什么是CustomRecyclerView? –

相关问题