RecyclerView in SwipeRefreshLayout not "wrap_content"
<p>I have a <code>RecyclerView</code> as the only child of <code>SwipeRefreshLayout</code>, I want the RecyclerView <code>wrap_content</code>. When I set both of them &quot;wrap_content&quot;, it doesn't work. The <code>RecyclerView</code> with fewer items also <code>match_parent</code>. When i delete <code>SwipeRefreshLayout</code>, the <code>RecyclerView</code> will <code>wrap_content</code>. Can anyone help me? My English is poor, Maybe you cann't understand.  Anyone can help me? Thank you very much.</p>
<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    android:id=&quot;@+id/container_v&quot;
    android:layout_width=&quot;match_parent&quot;
    android:layout_height=&quot;match_parent&quot;&gt;

    &lt;android.support.v4.widget.SwipeRefreshLayout
        android:layout_width=&quot;match_parent&quot;
        android:layout_height=&quot;wrap_content&quot;
        android:background=&quot;#00ffff&quot;&gt;

        &lt;android.support.v7.widget.RecyclerView
            android:id=&quot;@+id/recycler_view&quot;
            android:layout_width=&quot;match_parent&quot;
            android:layout_height=&quot;wrap_content&quot;
            android:background=&quot;#ff00ff&quot;&gt;

    &lt;/android.support.v7.widget.RecyclerView&gt;

&lt;/android.support.v4.widget.SwipeRefreshLayout&gt;
</code></pre>