title: How to make stretchable view with min height inside ConstraintLayout?
body: <p>Want I want to achieve is to compose two views, where one has some fixed aspect ratio and the other one stays below the first (unless the first gives enough space for the second one).</p>
  
  <p>Here is one case:</p>
  
  <p><a href="https://i.stack.imgur.com/Z4LCU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Z4LCU.png" alt="First case"></a></p>
  
  <p>Here is second case:</p>
  
  <p><a href="https://i.stack.imgur.com/hM6Gy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hM6Gy.png" alt="Second one"></a></p>
  
  <p>These two views are placed inside <code>ConstraintLayout</code>. I tried to use this part of code:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;androidx.constraintlayout.widget.ConstraintLayout 
      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;androidx.constraintlayout.widget.ConstraintLayout
          android:id="@+id/view1"
          android:layout_width="match_parent"
          android:layout_height="0dp"
          app:layout_constraintDimensionRatio="0.75"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toTopOf="parent"/&gt;
  
      &lt;androidx.constraintlayout.widget.ConstraintLayout
          android:id="@+id/view2"
          android:layout_width="match_parent"
          android:layout_height="0dp"
          app:layout_constraintHeight_min="100dp"
          app:layout_constraintBottom_toBottomOf="parent"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toBottomOf="@id/view1"/&gt;
  
  &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  </code></pre>
  
  <p>But it works only in the first case where there is enough space for View 2. In the second case, View 2 is moved below View 1 and it's outside the screen.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>I've found solution, which I'm not proud of it, but it works. Still waiting for better idea. How it works? I put additional view (placeholder) which doesn't have constrained width to <code>MATCH_PARENT</code> but it has bottom margin (simulating minimum height for View 2). Placeholder behaves in the same way like View 1 when there is more space than minimum height, but in other cases it narrows a little bit to leave bottom margin. </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;androidx.constraintlayout.widget.ConstraintLayout 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:background="@android:color/black"&gt;
  
      &lt;androidx.constraintlayout.widget.ConstraintLayout
          android:id="@+id/view1"
          android:layout_width="match_parent"
          android:layout_height="0dp"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintDimensionRatio="0.75"
          app:layout_constraintTop_toTopOf="parent"/&gt;
  
      &lt;View
          android:id="@+id/placeholder"
          android:layout_width="0dp"
          android:layout_height="0dp"
          android:layout_marginBottom="100dp"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toTopOf="parent"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintDimensionRatio="0.75"
          app:layout_constraintVertical_bias="0"
          app:layout_constraintBottom_toBottomOf="parent"/&gt;
  
      &lt;androidx.constraintlayout.widget.ConstraintLayout
          android:id="@+id/view2"
          android:layout_width="match_parent"
          android:layout_height="0dp"
          app:layout_constraintTop_toBottomOf="@id/placeholder"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintBottom_toBottomOf="parent"/&gt;
  
  &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  </code></pre>