title: ConstraintLayout - how to align centers of two views vertically
body: <p>I have two views - A and B. They have different heights. </p>
  
  <p>How to vertically align the centers of these views inside <code>ConstraintLayout</code>?</p>
  
  <p>For example, in the XML below, I would like the center of <code>img_change_picture</code> to be aligned with the center of <code>txt_change_picture</code>.</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:layout_width="match_parent"
  android:layout_height="match_parent"
  &gt;
  
  &lt;android.support.constraint.Guideline
      android:id="@+id/guideline_icons"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:orientation="vertical"
      app:layout_constraintGuide_percent="0.1"/&gt;
  
  &lt;android.support.constraint.Guideline
      android:id="@+id/guideline_text"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:orientation="vertical"
      app:layout_constraintGuide_percent="0.2"/&gt;
  
  &lt;ImageView
      android:id="@+id/img_change_picture"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      app:layout_constraintStart_toEndOf="@id/guideline_icons"
      app:layout_constraintTop_toBottomOf="@id/img_header"
      android:layout_marginTop="@dimen/settings_main_vertical_spacing"
      app:srcCompat="@drawable/change_picture"/&gt;
  
  &lt;TextView
      android:id="@+id/txt_change_picture"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      app:layout_constraintStart_toEndOf="@id/guideline_text"
      android:text="@string/settings_main_change_picture"
      /&gt;
  
  &lt;/android.support.constraint.ConstraintLayout&gt;
  </code></pre>