title: Bring view to front on MaterialCardView and ConstraintLayout with elevation
body: <p>within my layout which contains a <code>MaterialCardView</code> i want to add <code>app:cardElevation="10dp"</code>. </p>
  
  <p><a href="https://i.stack.imgur.com/4f8zT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4f8zT.png" alt="enter image description here"></a></p>
  
  <p>But when I apply the <code>cardElevation</code> my button gets messed up. </p>
  
  <p><a href="https://i.stack.imgur.com/KVkbG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KVkbG.png" alt="enter image description here"></a></p>
  
  <p>I tried many suggestions from other questions like adding a huge amount of elevation to the button or changing the Z order but it doesn't work.</p>
  
  <pre><code>    ViewCompat.setElevation(button, 1000.0f)
      ViewCompat.setTranslationZ(button, 1000.0f)
      button.bringToFront()
      login_card.invalidate()
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p><a href="https://gist.github.com/chrjsorg/67131e72bddb0056618620ae23c3e095" rel="nofollow noreferrer">Complete Layout Xml</a>
  Layout XML (shortened):
  
  </p>
  
  <pre><code>&lt;com.google.android.material.card.MaterialCardView
      android:id="@+id/login_card"
      android:layout_width="match_parent"
      app:cardElevation="10dp i'm breaking the layout-----------"
      android:layout_height="wrap_content"
      app:layout_constraintBottom_toBottomOf="parent"
      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintHorizontal_bias="0.5"
      app:layout_constraintStart_toStartOf="parent"
      app:layout_constraintTop_toTopOf="parent"&gt;
  
      &lt;androidx.constraintlayout.widget.ConstraintLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"&gt;
  
          &lt;com.google.android.material.textfield.TextInputLayout
          ...
          &lt;/com.google.android.material.textfield.TextInputLayout&gt;
  
          &lt;com.google.android.material.textfield.TextInputLayout
          ...
          &lt;/com.google.android.material.textfield.TextInputLayout&gt;
  
      &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  &lt;/com.google.android.material.card.MaterialCardView&gt;
  
  &lt;androidx.appcompat.widget.AppCompatButton
      android:id="@+id/login_button_login"
      android:layout_width="@dimen/login_button_width"
      android:layout_height="wrap_content"
      app:elevation="1000dp"
      android:text="@string/login_button_login"
      app:layout_constraintBottom_toBottomOf="@id/login_card"
      app:layout_constraintEnd_toEndOf="@+id/login_card"
      app:layout_constraintStart_toStartOf="@+id/login_card"
      app:layout_constraintTop_toBottomOf="@+id/login_card"
      app:layout_constraintVertical_bias="1" /&gt;
  </code></pre>
  
  <p></p>