title: Constraint layout center vertically if place
body: <p>I center my two Input layout vertically in my view using chaining. I also have an image view and a text view on top of this two Input layout. I would like to have this Input Layout center <strong>only</strong> if the view enough space. </p>
  
  <p>Right now the Input layout are always center and the text go over the image.</p>
  
  <p>In ios i would use constraint priority to do so but it looks like this is not available for constraint layout yet?</p>
  
  <p>What i have right now</p>
  
  <p><a href="https://i.stack.imgur.com/1SwKv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1SwKv.png" alt="enter image description here"></a></p>
  
  <p>What I want to have is</p>
  
  <p><a href="https://i.stack.imgur.com/zDe1G.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zDe1G.png" alt="enter image description here"></a></p>
  
  <p>Edit</p>
  
  <p>Sorry i should have add the text :)</p>
  
  <pre><code>&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:id="@+id/registration_layout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@android:color/transparent"&gt;
  
      &lt;ImageView
          android:id="@+id/imageView"
          android:layout_width="wrap_content"
          android:layout_height="0dp"
          android:layout_marginEnd="32dp"
          android:layout_marginStart="32dp"
          android:layout_marginTop="32dp"
          android:adjustViewBounds="true"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toTopOf="parent"
          app:srcCompat="@drawable/logo" /&gt;
  
      &lt;!--To get the focus when page appear--&gt;
      &lt;include layout="@layout/layout_focus_interceptor" /&gt;
  
      &lt;TextView
          android:id="@+id/tv_extra_info"
          style="@style/TextContent"
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:layout_marginBottom="16dp"
          android:layout_marginEnd="16dp"
          android:layout_marginLeft="16dp"
          android:layout_marginRight="16dp"
          android:layout_marginStart="16dp"
          android:layout_marginTop="16dp"
          android:gravity="center"
          app:layout_constraintBottom_toTopOf="@+id/input_layout_email"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toBottomOf="@+id/imageView" /&gt;
  
      &lt;android.support.design.widget.TextInputLayout
          android:id="@+id/input_layout_email"
          style="@style/TextInputLayout"
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:layout_marginBottom="@dimen/margin_bottom_text_input_layout"
          android:layout_marginTop="8dp"
          android:theme="@style/PreAuthorizationTextTheme"
          app:layout_constraintBottom_toTopOf="@id/input_layout_email_confirmation"
          app:layout_constraintRight_toRightOf="parent"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toTopOf="parent"
          app:layout_constraintVertical_chainStyle="packed"&gt;
  
          &lt;android.support.design.widget.TextInputEditText
              android:id="@+id/etxt_email"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:inputType="textEmailAddress"
              android:nextFocusLeft="@id/etxt_email"
              android:nextFocusUp="@id/etxt_email"
              tools:hint="@string/general_email" /&gt;
      &lt;/android.support.design.widget.TextInputLayout&gt;
  
      &lt;android.support.design.widget.TextInputLayout
          android:id="@+id/input_layout_email_confirmation"
          style="@style/TextInputLayout"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_marginBottom="@dimen/margin_bottom_text_input_layout"
          android:layout_marginTop="@dimen/margin_top_text_input_layout"
          android:theme="@style/PreAuthorizationTextTheme"
          app:layout_constraintBottom_toBottomOf="parent"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintLeft_toLeftOf="parent"
          app:layout_constraintRight_toRightOf="parent"
          app:layout_constraintTop_toBottomOf="@id/input_layout_email"&gt;
  
          &lt;android.support.design.widget.TextInputEditText
              android:id="@+id/et_email_confirmation"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:inputType="textEmailAddress"
              android:nextFocusLeft="@id/etxt_email"
              android:nextFocusUp="@id/etxt_email"
              tools:hint="@string/registration_email_confirmation" /&gt;
  
      &lt;/android.support.design.widget.TextInputLayout&gt;
  
  &lt;/android.support.constraint.ConstraintLayout&gt;
  </code></pre>