title: Recyclerview binds all views at the same time
body: <p>I have a vertical recyclerview (with a <code>GridLayoutManager</code>) inside another recyclerview (with <code>LinearLayoutManager</code>). The problem I am facing right now is that, the inner recyclerview (with GridLayoutManager) binds all of it's items at the same time, even the views that are not on the screen at the moment (<code>onBindViewHolder()</code> gets called for all of its items).</p>
  
  <p>To give you more information, in my layout file, I put height of my recycler view as <code>wrap_content</code>.</p>
  
  <p>I think the problem is, since there are 2 nested vertically recyclerviews, when the parent RV wants to measure its children and the children is another RV, in <code>onMeasure()</code> it computes the size needed for the entire RV, not just the portion that it wants to bind on the screen.</p>
  
  <p>Any idea how to solve this?</p>
  
  <p>Here is the layout file for my outer recyclerview:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"&gt;
  
  &lt;android.support.v7.widget.RecyclerView
      android:id="@+id/component_list"
      android:layout_width="match_parent"
      android:layout_height="match_parent"/&gt;
  
  &lt;/FrameLayout&gt;
  </code></pre>
  
  <p>And here is the code for my inner recyclerview:</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/container"
  android:orientation="vertical"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:paddingTop="@dimen/gutter"
  android:paddingBottom="@dimen/gutter"&gt;
  
  &lt;TextView
      android:id="@+id/title_text"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginBottom="@dimen/gutter"
      android:textSize="30sp"
      android:textColor="@android:color/white"
      android:fontFamily="sans-serif-thin"/&gt;
  
  &lt;android.support.v7.widget.RecyclerView
      android:id="@+id/my_slider"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"/&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>P.S.: I'm using this adapter delegate for my outer recyclerview: 
  <a href="https://github.com/sockeqwe/AdapterDelegates" rel="noreferrer">https://github.com/sockeqwe/AdapterDelegates</a></p>