title: Align views right in ConstraintLayout without clipping
body: <p>I am creating a dialog with two buttons aligned right in relation to the parent ConstraintLayout.</p>
  
  <p>Everything is fine, until the text of the buttons becomes very long. When the text of either or both buttons is lengthy, the buttons extend beyond the bounds of the parent, causing clipping of the text, as shown in the image below. I would like to handle cases where there is longer text. </p>
  
  <p>i.e. The desired behavior would be </p>
  
  <ul>
  <li>buttons should wrap text when text is long</li>
  <li>buttons should stay within bounds of parent and obey parent padding</li>
  <li>buttons should stay aligned right of parent</li>
  </ul>
  
  <p><strong>When button text is short, the layout works as intended:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/d7nby.png" rel="noreferrer"><img src="https://i.stack.imgur.com/d7nby.png" alt="enter image description here"></a></p>
  
  <p><strong>When button text is long:</strong></p>
  
  <ul>
  <li>Cancel text is truncated when cancel button text is long. This is happening because the button itself is being pushed past the parent's boundaries.
  <a href="https://i.stack.imgur.com/iQNiW.png" rel="noreferrer"><img src="https://i.stack.imgur.com/iQNiW.png" alt="enter image description here"></a></li>
  <li>Cancel text pushed beyond parent boundaries when ok button's text is long, again, because the button is pushed beyond the parent's boundaries.
  <a href="https://i.stack.imgur.com/7NHsl.png" rel="noreferrer"><img src="https://i.stack.imgur.com/7NHsl.png" alt="enter image description here"></a></li>
  </ul>
  
  <p><strong>Layout code</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.constraint.ConstraintLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:paddingBottom="@dimen/dialog_padding"
      android:paddingLeft="@dimen/dialog_padding"
      android:paddingRight="@dimen/dialog_padding"
      android:paddingTop="@dimen/dialog_padding"&gt;
  
      &lt;TextView
          android:id="@+id/dialog_title"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_marginTop="@dimen/dialog_text_margin"
          tools:text="Dialog title" /&gt;
  
      &lt;TextView
          android:id="@+id/dialog_content"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_marginTop="@dimen/dialog_text_margin"
          app:layout_constraintTop_toBottomOf="@id/dialog_title"
          tools:text="Dialog text content" /&gt;
  
      &lt;Button
          android:id="@+id/cancel_btn"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          app:layout_constraintEnd_toStartOf="@id/ok_btn"
          app:layout_constraintTop_toBottomOf="@id/dialog_content"
          tools:text="Dismiss" /&gt;
  
      &lt;Button
          android:id="@+id/ok_btn"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintTop_toBottomOf="@id/dialog_content"
          tools:text="Accept" /&gt;
  &lt;/android.support.constraint.ConstraintLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>Things that I've tried to no avail:</strong></p>
  
  <ul>
  <li>adding <code>app:layout_constraintStart_toStartOf="parent"</code> to the cancel button causes the buttons to no longer be aligned right, and so that solution is incorrect</li>
  <li>constraining the end of the dismiss button to the start of the accept button causes buttons to no longer be aligned right</li>
  <li>using <code>layout_width="0dp"</code> for the buttons and using <code>app:layout_constrainedWidth="true"</code> has no effect</li>
  </ul>