title: How to stretch the middle view vertically in a ConstraintLayout
body: <p>I have two TextInputLayouts as a header and a footer in my XML layout, and a RecyclerView in between. What I wanna achieve is to set the height of the RecyclerView to fill the area between the other two.</p>
  <p>I've tried setting constrains of the RecyclerView based on the header and footer and setting layout_height to 0dp, but it seems there's a problem. The RecyclerView gets crushed to 0 pixels in runtime.</p>
  <p>Here's my code:</p>
  <pre><code>&lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;wrap_content&quot;
      android:layoutDirection=&quot;ltr&quot;&gt;
  
      &lt;com.google.android.material.textfield.TextInputLayout
          android:id=&quot;@+id/tilSearchTitle&quot;
          android:layout_width=&quot;0dp&quot;
          android:layout_height=&quot;60dp&quot;
          android:background=&quot;@android:color/transparent&quot;
          app:boxBackgroundColor=&quot;@android:color/transparent&quot;
          app:layout_constraintTop_toTopOf=&quot;parent&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot;
          app:layout_constraintEnd_toEndOf=&quot;parent&quot;
          app:startIconDrawable=&quot;@drawable/ic_search&quot;&gt;
  
          &lt;com.google.android.material.textfield.TextInputEditText
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;60dp&quot;
              android:background=&quot;@android:color/transparent&quot;
      &lt;/com.google.android.material.textfield.TextInputLayout&gt;
  
      &lt;androidx.recyclerview.widget.RecyclerView
          android:id=&quot;@+id/rvTitles&quot;
          android:layout_width=&quot;0dp&quot;
          android:layout_height=&quot;0dp&quot;
          android:layoutAnimation=&quot;@anim/layout_animation&quot;
          android:paddingVertical=&quot;8dp&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot;
          app:layout_constraintEnd_toEndOf=&quot;parent&quot;
          app:layout_constraintBottom_toTopOf=&quot;@id/tilTitleValue&quot;
          app:layout_constraintTop_toBottomOf=&quot;@id/tilSearchTitle&quot; /&gt;
  
      &lt;com.google.android.material.textfield.TextInputLayout
          android:id=&quot;@+id/tilTitleValue&quot;
          style=&quot;@style/Widget.MaterialComponents.TextInputLayout.FilledBox&quot;
          android:layout_width=&quot;0dp&quot;
          android:layout_height=&quot;60dp&quot;
          android:hint=&quot;@string/str23&quot;
          app:boxBackgroundColor=&quot;@color/col_deep_bg&quot;
          app:counterMaxLength=&quot;30&quot;
          app:counterTextAppearance=&quot;@style/CounterStyle&quot;
          app:expandedHintEnabled=&quot;false&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot;
          app:layout_constraintEnd_toEndOf=&quot;parent&quot;
          app:layout_constraintBottom_toBottomOf=&quot;parent&quot;&gt;
  
          &lt;com.zeroone.mooyrag.customui.MyTIET
              android:id=&quot;@+id/tietTitleValue&quot;
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;60dp&quot;
              android:fontFamily=&quot;@font/iransans_med_fa&quot;
              android:maxLines=&quot;1&quot;
              android:scrollHorizontally=&quot;true&quot;
              android:textAlignment=&quot;center&quot;
              android:textSize=&quot;13sp&quot; /&gt;
      &lt;/com.google.android.material.textfield.TextInputLayout&gt;
  
  &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  </code></pre>