title: View in Constraint Layout moves to top on changing width and height in Java
body: <p>When I modify the width and height of button in java (Constraint Layout) then the button automatically moves to the top on click. Please check the code below and let me know what the issue is. PS - I am new to constraint layout</p>
  
  <p><strong>Layout File</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context=".MainActivity"&gt;
  
  
      &lt;ImageButton
          android:id="@+id/ibEgg"
          android:layout_width="250dp"
          android:layout_height="350dp"
          android:layout_marginBottom="8dp"
          android:layout_marginEnd="8dp"
          android:layout_marginLeft="8dp"
          android:layout_marginRight="8dp"
          android:layout_marginStart="8dp"
          android:layout_marginTop="8dp"
          android:background="@null"
          android:scaleType="fitXY"
          app:layout_constraintBottom_toBottomOf="parent"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toTopOf="parent"
          app:srcCompat="@drawable/egg" /&gt;
  
  &lt;/android.support.constraint.ConstraintLayout&gt;
  </code></pre>
  
  <p><strong>Java Code</strong></p>
  
  <pre><code>ibEgg.setOnTouchListener(new View.OnTouchListener() {
              @Override
              public boolean onTouch(View view, MotionEvent motionEvent) {
                  switch (motionEvent.getAction()) {
                      case MotionEvent.ACTION_DOWN:
                          ConstraintLayout.LayoutParams layoutParams = new ConstraintLayout.LayoutParams(250,350);
                          ibEgg.setLayoutParams(layoutParams);
                          return true; // if you want to handle the touch event
                      case MotionEvent.ACTION_UP:
                          ConstraintLayout.LayoutParams layoutParams1 = new ConstraintLayout.LayoutParams(300,400);
                          ibEgg.setLayoutParams(layoutParams1);
                          return true; // if you want to handle the touch event
                  }
                  return false;
              }
          });
  </code></pre>