NestedScrollview + TextView + RecyclerView
<p>I have a fragment xml in a TabLayout. The TabLayout is in a CollapsingToolbar layout which collapses when scrolling the content of the Fragments in the TabLayout down. I have one fragment where I need a TextView above a recyclerView.</p>

<p>If I have the layout as below taken from <a href="https://stackoverflow.com/questions/35553305/scroll-a-textview-out-the-screen/35553784?noredirect=1">this question I asked before</a>:</p>

<pre><code>&lt;LinearLayout&gt;
    &lt;NestedScrollView
      &lt;TextView&gt;
      &lt;/TextView&gt;
    &lt;/NestedScrollView&gt;
  &lt;View&gt;
  &lt;/View&gt;
  &lt;RecyclerView&gt;
  &lt;/RecyclerView&gt;
&lt;/LinearLayout&gt;
</code></pre>

<p>It works ok, until the TextView has so much content in that it fills or takes up most of the screen, the RecyclerView ends up using the remaining space in the view to be displayed:</p>

<blockquote>
<pre><code>|------------------|
|&lt;TextView--------&gt;|
|&lt;----------------&gt;|
|&lt;----------------&gt;|
|&lt;----------------&gt;|
|&lt;----------------&gt;|
|&lt;/TextView-------&gt;|
|&lt;RecyclerView----&gt;|
|&lt;/RecyclerView---&gt;|
|__________________|
</code></pre>
</blockquote>

<p>So the recyclerview is left with minimal space to be viewed. If the Textview takes up the whole screen, the recyclerView just doesn't display.</p>

<p>Taken from <a href="https://stackoverflow.com/questions/31789554/android-scrollview-and-recyclerview">this SO Question</a>
If the layout is:</p>

<pre><code>&lt;FrameLayout&gt;
    &lt;NestedScrollView
      &lt;TextView&gt;
      &lt;/TextView&gt;
    &lt;/NestedScrollView&gt;
  &lt;View&gt;
  &lt;/View&gt;
  &lt;RecyclerView&gt;
  &lt;/RecyclerView&gt;
&lt;/FrameLayout&gt;
</code></pre>

<p>Only the recyclerView displays and the TextView is just nonexistent.</p>

<p>If the Layout is:</p>

<pre><code>&lt;NestedScrollView&gt;
   &lt;LinearLayout
      &lt;TextView&gt;
      &lt;/TextView&gt;
      &lt;View&gt;
      &lt;/View&gt;
      &lt;RecyclerView&gt;
      &lt;/RecyclerView&gt;
   &lt;/LinearLayout&gt;
&lt;/NestedScrollView&gt;
</code></pre>

<p>The TextView just shows, whether there is content in the RecyclerView or not.</p>

<p>How can I have the TextView scroll out the window enough to reveal the recyclerview  so the screen can go from this:</p>

<blockquote>
<pre><code>|------------------|
|&lt;TextView--------&gt;|
|&lt;----------------&gt;|
|&lt;----------------&gt;|
|&lt;----------------&gt;|
|&lt;----------------&gt;|
|&lt;/TextView-------&gt;|
|&lt;RecyclerView----&gt;|
|&lt;/RecyclerView---&gt;|
|__________________|
</code></pre>
</blockquote>

<p>to this:</p>

<blockquote>
<pre><code>|------------------|
|&lt;----------------&gt;|
|&lt;/TextView-------&gt;|
|&lt;RecyclerView----&gt;|
|&lt;----------------&gt;|
|&lt;----------------&gt;|
|&lt;----------------&gt;|
|&lt;----------------&gt;|
|&lt;/RecyclerView---&gt;|
|__________________|
</code></pre>
</blockquote>

<p>My current XML code where only the RecyclerView shows and not the TextView:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
             xmlns:app="http://schemas.android.com/apk/res-auto"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:background="@color/white"
             app:layout_behavior="@string/appbar_scrolling_view_behavior"&gt;


  &lt;LinearLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical"&gt;

    &lt;android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"&gt;

      &lt;TextView
          android:id="@+id/item_shipping_shipping_description"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_gravity="start|left"
          android:padding="@dimen/margin_16"
          app:layout_behavior="@string/appbar_scrolling_view_behavior"/&gt;
    &lt;/android.support.v4.widget.NestedScrollView&gt;

    &lt;View
        android:id="@+id/line43"
        android:layout_width="match_parent"
        android:layout_height="@dimen/line_height"
        android:background="@color/light_gray"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"/&gt;

  &lt;/LinearLayout&gt;


  &lt;android.support.v7.widget.RecyclerView
      android:id="@+id/item_shipping_fragment_recyclerview"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:background="@color/white"
      app:layout_behavior="@string/appbar_scrolling_view_behavior"/&gt;
&lt;/FrameLayout&gt;
</code></pre>