title: How to move a TextView into the Toolbar through CoordinatorLayout?
body: <p>I'm working on building a <code>coordinator layout</code> that is made up of a toolbar, a relative layout that is to hide on scroll, a layout that is static always above the <code>scrollable list</code>, and a <code>RecyclerView</code>.</p>
  
  <p>I currently have it laid out as I want it to, as seen here:</p>
  
  <ul>
  <li>Green is the toolbar</li>
  <li>Orange is the relative layout to hide on scroll</li>
  <li>Red is my static layout that is to stay above the recycler view and
  move up but not hide.</li>
  <li>White is my RecyclerView</li>
  </ul>
  
  <p><a href="https://i.stack.imgur.com/H9TXu.png" rel="noreferrer"><img src="https://i.stack.imgur.com/H9TXu.png" alt=""></a></p>
  
  <p>This next image is what it looks like once I scroll the whole way up the recycler view.</p>
  
  <p>So my orange view hides as I want it to, which is perfect.  The only step i'm missing is moving the "Title 1" textview into becoming the title of the toolbar.  I've seen examples where they have done something kind of similar with an image, but haven't been able to duplicate it yet with a custom behavior.  I'm assuming thats what this will take?</p>
  
  <p>Does anyone have any advice on if my layout needs to change to make this possible, and any advice for a custom behavior if that is what this will take?</p>
  
  <p><a href="https://i.stack.imgur.com/koD9G.png" rel="noreferrer"><img src="https://i.stack.imgur.com/koD9G.png" alt="enter image description here"></a></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.design.widget.CoordinatorLayout
      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="match_parent"&gt;
  
      &lt;android.support.design.widget.AppBarLayout
          android:id="@+id/appBarLayout"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"&gt;
          &lt;android.support.design.widget.CollapsingToolbarLayout
              android:id="@+id/collapsing_toolbar"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"&gt;
              &lt;!-- HEADER --&gt;
              &lt;RelativeLayout
                  android:id="@+id/rel1"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  app:layout_collapseMode="parallax"
                  android:background="@color/lightGreen"
                  android:layout_marginTop="?attr/actionBarSize"
                  android:paddingTop="10dp"
                  android:paddingBottom="10dp"&gt;
                  &lt;TextView
                      android:id="@+id/title1"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_centerHorizontal="true"
                      android:text="Resist the urge"
                      android:textSize="35sp"
                      android:includeFontPadding="true"
                      android:layout_centerInParent="true"/&gt;
  
                  &lt;TextView
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_below="@id/resistUrgeTitleTextView"
                      android:layout_centerHorizontal="true"
                      android:text="Use a method below to help."
                      android:includeFontPadding="true"/&gt;
              &lt;/RelativeLayout&gt;
  
              &lt;FrameLayout
                  android:id="@+id/main.framelayout.title"
                  android:layout_width="match_parent"
                  android:layout_height="100dp"
                  android:layout_gravity="bottom|center_horizontal"
                  android:background="@color/lightOrange"
                  android:orientation="vertical"
                  app:layout_collapseMode="parallax"
                  &gt;
  
                  &lt;LinearLayout
                      android:id="@+id/main.linearlayout.title"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_gravity="center"
                      android:orientation="vertical"
                      &gt;
  
                      &lt;TextView
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:layout_gravity="center_horizontal"
                          android:gravity="bottom|center"
                          android:text="Title 1"
                          android:textColor="@android:color/white"
                          android:textSize="30sp"
                          app:layout_behavior="com.uhg.ent.mobile.quit4life.UrgeIntervention.TitleTextViewBehavior"
                          /&gt;
  
                      &lt;TextView
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:layout_gravity="center_horizontal"
                          android:layout_marginTop="4dp"
                          android:text="Subtitle"
                          android:textColor="@android:color/white"
                          /&gt;
  
                  &lt;/LinearLayout&gt;
              &lt;/FrameLayout&gt;
  
              &lt;android.support.v7.widget.Toolbar
                  android:id="@+id/toolbar"
                  android:layout_width="match_parent"
                  android:layout_height="?attr/actionBarSize"
                  android:background="?attr/colorPrimary"
                  android:backgroundTint="@color/lightGreen"
                  app:layout_collapseMode="pin"
                  app:title=""/&gt;
              &lt;!--&lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="center_vertical|center_horizontal"
                  android:text="Resist the urge"
                  android:textColor="@android:color/black"
                  android:textSize="30sp"
                  app:layout_behavior="com.uhg.ent.mobile.quit4life.UrgeIntervention.TitleTextViewBehavior"
                  /&gt;--&gt;
  
  
          &lt;/android.support.design.widget.CollapsingToolbarLayout&gt;
          &lt;android.support.constraint.ConstraintLayout
              android:id="@+id/cardConstraintLayout"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              app:layout_constraintTop_toTopOf="parent"
              app:layout_constraintStart_toStartOf="parent"
              app:layout_constraintEnd_toEndOf="parent"
              android:background="@android:color/holo_red_dark"
              android:layout_marginTop="0dp"&gt;
  
              &lt;android.support.v4.view.ViewPager
                  android:id="@+id/pager"
                  android:layout_width="0dp"
                  android:layout_height="175dp"
                  android:layout_alignParentStart="true"
                  android:layout_alignParentTop="true"
                  app:layout_constraintBottom_toBottomOf="parent"
                  app:layout_constraintEnd_toEndOf="parent"
                  app:layout_constraintStart_toStartOf="parent"
                  app:layout_constraintTop_toTopOf="parent"
                  app:layout_constraintVertical_bias="0"
                  android:paddingBottom="50dp"/&gt;
              &lt;android.support.design.widget.TabLayout
                  android:layout_width="wrap_content"
                  android:layout_height="20dp"
                  android:id="@+id/viewPagerIndicator"
                  app:tabBackground="@drawable/pager_indicator_selector_gray"
                  app:tabGravity="center"
                  app:tabIndicatorHeight="0dp"
                  app:layout_constraintStart_toStartOf="parent"
                  app:layout_constraintEnd_toEndOf="parent"
                  app:layout_constraintBottom_toBottomOf="parent"
                  app:layout_constraintTop_toBottomOf="@id/interventionCategoryViewPager"
                  android:layout_marginBottom="10dp"/&gt;
          &lt;/android.support.constraint.ConstraintLayout&gt;
          &lt;!-- &lt;/android.support.design.widget.CollapsingToolbarLayout&gt;--&gt;
          &lt;!--&lt;android.support.v7.widget.Toolbar
              android:id="@+id/main.toolbar"
              android:layout_width="match_parent"
              android:layout_height="?attr/actionBarSize"
              android:background="@color/colorPrimary"
              app:layout_anchor="@id/main.framelayout.title"
              app:theme="@style/ThemeOverlay.AppCompat.Dark"
              app:title=""
              app:layout_collapseMode="pin"&gt;
          &lt;/android.support.v7.widget.Toolbar&gt;--&gt;
      &lt;/android.support.design.widget.AppBarLayout&gt;
      &lt;android.support.v7.widget.RecyclerView
          android:id="@+id/recyclerView"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:background="@android:color/white"
          app:layout_behavior="@string/appbar_scrolling_view_behavior"&gt;
      &lt;/android.support.v7.widget.RecyclerView&gt;
    &lt;/android.support.design.widget.CoordinatorLayout&gt;
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>I've got a little bit of progress made.  I think I have the layout how I want, and i've got a behavior started.  I am able to move the TextView, but it is getting lost behind the toolbar.  I want it to go on top of the toolbar.  My goal is to move the title from the yellow block into the green block.</p>
  
  <p>Do I need to adjust my layout so make it possible for the textview to appear on top of the title bar?</p>
  
  <p><a href="https://i.stack.imgur.com/MWQjR.png" rel="noreferrer"><img src="https://i.stack.imgur.com/MWQjR.png" alt="enter image description here"></a></p>
  
  <p>New code layout</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout
      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="match_parent"
      android:orientation="vertical"&gt;
      &lt;android.support.v7.widget.Toolbar
          android:id="@+id/toolbar"
          android:layout_width="match_parent"
          android:layout_height="60dp"
          android:background="?attr/colorPrimary"
          android:backgroundTint="@color/lightOrange"
          app:title=""
          android:layout_marginTop="20dp"/&gt;
      &lt;android.support.design.widget.CoordinatorLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_below="@id/toolbar"&gt;
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="center_horizontal"
              android:gravity="bottom|center"
              android:text="Test 1"
              android:textColor="@android:color/white"
              android:textSize="30sp"
              app:layout_behavior="com.uhg.ent.mobile.quit4life.UrgeIntervention.TitleTextViewBehavior"
              android:elevation="100dp"/&gt;
          &lt;android.support.design.widget.AppBarLayout
              android:id="@+id/appBarLayout"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"&gt;
  
              &lt;android.support.design.widget.CollapsingToolbarLayout
                  android:id="@+id/collapsing_toolbar"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"&gt;
                  &lt;LinearLayout
                      android:id="@+id/main.framelayout.title"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:layout_gravity="bottom|center_horizontal"
                      android:background="@color/lightGreen"
                      android:orientation="vertical"
                      app:layout_collapseMode="parallax"
                      android:paddingTop="50dp"&gt;
                      &lt;!--&lt;TextView
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:layout_gravity="center_horizontal"
                          android:gravity="bottom|center"
                          android:text="Resist The Urge"
                          android:textColor="@android:color/white"
                          android:textSize="30sp"
                          app:layout_behavior="com.uhg.ent.mobile.quit4life.UrgeIntervention.TitleTextViewBehavior"
                          android:paddingTop="20dp"/&gt;--&gt;
                      &lt;TextView
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:layout_gravity="center_horizontal"
                          android:layout_marginTop="4dp"
                          android:text="Test 2."
                          android:textColor="@android:color/white"
                          android:paddingBottom="20dp"
                          /&gt;
                  &lt;/LinearLayout&gt;
              &lt;/android.support.design.widget.CollapsingToolbarLayout&gt;
              &lt;android.support.constraint.ConstraintLayout
                  android:id="@+id/cardConstraintLayout"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  app:layout_constraintTop_toTopOf="parent"
                  app:layout_constraintStart_toStartOf="parent"
                  app:layout_constraintEnd_toEndOf="parent"
  
                  android:layout_marginTop="0dp"&gt;
  
                  &lt;android.support.v4.view.ViewPager
                      android:id="@+id/viewPager"
                      android:layout_width="0dp"
                      android:layout_height="175dp"
                      android:layout_alignParentStart="true"
                      android:layout_alignParentTop="true"
                      app:layout_constraintBottom_toBottomOf="parent"
                      app:layout_constraintEnd_toEndOf="parent"
                      app:layout_constraintStart_toStartOf="parent"
                      app:layout_constraintTop_toTopOf="parent"
                      app:layout_constraintVertical_bias="0"
                      android:paddingBottom="50dp"/&gt;
                  &lt;android.support.design.widget.TabLayout
                      android:layout_width="wrap_content"
                      android:layout_height="20dp"
                      android:id="@+id/viewPagerIndicator"
                      app:tabBackground="@drawable/pager_indicator_selector_gray"
                      app:tabGravity="center"
                      app:tabIndicatorHeight="0dp"
                      app:layout_constraintStart_toStartOf="parent"
                      app:layout_constraintEnd_toEndOf="parent"
                      app:layout_constraintBottom_toBottomOf="parent"
                      app:layout_constraintTop_toBottomOf="@id/interventionCategoryViewPager"
                      android:layout_marginBottom="10dp"/&gt;
              &lt;/android.support.constraint.ConstraintLayout&gt;
          &lt;/android.support.design.widget.AppBarLayout&gt;
  
          &lt;android.support.v7.widget.RecyclerView
              android:id="@+id/recyclerView"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:background="@android:color/white"
              app:layout_behavior="@string/appbar_scrolling_view_behavior"&gt;
          &lt;/android.support.v7.widget.RecyclerView&gt;
      &lt;/android.support.design.widget.CoordinatorLayout&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>