2017-07-30 42 views
0

NestedScrollView看起来像我仍然失去了一些东西。请看看我的代码我的下面。NestedScrollView与RecyclerView不<code>RecyclerView</code>在它不滚动</p> <p>我试图在这个论坛上讨论的所有选项..滚动

<?xml version="1.0" encoding="utf-8"?> 
<layout xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:fresco="http://schemas.android.com/apk/res-auto"> 

    <data> 
     <variable 
      name="message" 
      type="Post" /> 
    </data> 

    <android.support.v4.widget.NestedScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:fillViewport="true" 
     > 

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


      <android.support.v7.widget.CardView 
        android:layout_height="wrap_content" 
        android:layout_width="match_parent" 
        style="@style/MyCardViewStyle" 
        android:layout_marginBottom="5dp" 
        android:id="@+id/post_card1" 

        > 


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


      <android.support.v7.widget.RecyclerView 
       android:id="@+id/image_gallery" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       app:layoutManager="LinearLayoutManager"> 

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

      <android.support.v7.widget.RecyclerView 
       android:id="@+id/doc_gallery" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       app:layoutManager="LinearLayoutManager"> 

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


      <android.support.v7.widget.RecyclerView 
       android:id="@+id/post_replies" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       app:layoutManager="LinearLayoutManager"> 

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


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


</layout> 

而且我在所有三个RecyclerViews设置isNestedScrollingEnabled = false

屏幕只是似乎被卡住,而不是在所有的滚动

+0

也许是因为'NestedScrollView'内的'layout_height'参数都设置为'wrap_content'?你作为结果得到什么? –

+0

在一个案例中,我有第一个和第三个回收站点的数据。我可以看到第三个数据超出观点,但我仍然不能向下滚动。如果我将layout_height参数更改为match_parent,则不会显示recyclerviews – Rauzr

+0

尝试将'LinearLayout'的高度设置为'match_parent'。 –

回答

0

对回收的意见创建单独的布局文件。并将其包含到列表视图中。

您有类似

<LinuearLayout ..> 
    <CardView> 
    <RecyclerView> 
    <RecyclerView> 
    <RecyclerView> 
</LinearLayout> 

你可以把它改成,

<LinuearLayout ..> 
    <include layout="@layout/cv1"/> 
    <include layout="@layout/rv1"/> 
    <include layout="@layout/rv2"/> 
    <include layout="@layout/rv3"/> 
</LinearLayout> 

这只是你的线索。过去我早就解决过类似的问题。请尝试尝试这个线索。