title: Translation animation of view when referenced view's width is wrap_content in ConstraintSet animation
body: <p>This is the design of xml layout <code>begin.xml</code>:</p>
  
  <pre class="lang-xml prettyprint-override"><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:orientation="vertical"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          &gt;
  
      &lt;Button
              android:id="@+id/delete"
              android:layout_width="wrap_content"
              android:layout_height="match_parent"
              android:text="@string/delete"
              android:layout_margin="0dp"
              style="@style/DeleteButton"
              app:layout_constraintEnd_toEndOf="parent"
              app:layout_constraintTop_toTopOf="parent"
              app:layout_constraintBottom_toBottomOf="parent"
              android:translationZ="-2dp"
              /&gt;
  
      &lt;View
              android:id="@+id/top_layer"
              android:layout_width="0dp"
              android:layout_height="0dp"
              android:background="@color/white"
              app:layout_constraintEnd_toEndOf="parent"
              app:layout_constraintTop_toTopOf="parent"
              app:layout_constraintBottom_toBottomOf="parent"
              app:layout_constraintStart_toStartOf="parent"
              /&gt;
  
      &lt;ImageButton
              android:id="@+id/bet_slip_remove_item"
              android:layout_width="30dp"
              android:layout_height="30dp"
              app:srcCompat="@drawable/close"
              android:background="@drawable/button_white_radius_10"
              app:layout_constraintTop_toTopOf="parent"
              app:layout_constraintBottom_toBottomOf="parent"
              app:layout_constraintEnd_toEndOf="@id/top_layer"
              android:contentDescription="@string/close"
              /&gt;
  
      &lt;TextView
          android:id="@+id/some_text"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="@string/timeout_error"
          app:layout_constraintTop_toTopOf="@id/top_layer"
          app:layout_constraintBottom_toBottomOf="@id/top_layer"
          app:layout_constraintStart_toStartOf="@id/top_layer"
          android:layout_marginStart="8dp"
          /&gt;
  &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  </code></pre>
  
  <p>It looks something like this:</p>
  
  <p><a href="https://i.stack.imgur.com/uwlne.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uwlne.png" alt="enter image description here"></a></p>
  
  <p>There is a <code>Delete</code> button hidden behind <code>top_layer</code> view.</p>
  
  <p>By clicking on "X" I wish, by using ConstraintSet animations, <code>top_layer</code> view to go left with its left part to be outside of the screen and to reveal <code>Delete</code> button, to get something like this:</p>
  
  <p><a href="https://i.stack.imgur.com/0rIPR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0rIPR.png" alt="enter image description here"></a></p>
  
  <p>The problem lies in the fact that <code>Delete</code> button has its width set to <code>wrap_content</code>, but even if it has the fixed width, how can I set xml layout <code>end.xml</code>, to get the desired design on the last picture?</p>
  
  <p>Setting view's position that one part of it is outside of screen puzzles me.</p>
  
  <p>Side note: I use <code>top_layer</code> view for two reasons: </p>
  
  <ol>
  <li><p>it hides DeleteButton</p></li>
  <li><p>since all views (X, TextView and presumably others which should be there) should move to the left together, I set their constraints to be relative to <code>top_layer</code>'s dimensions.</p></li>
  </ol>