title: Why ConstraintLayout 1.1.0 layout_constraintWidth_percent and layout_constraintDimensionRatio cannot work together?
body: <p>I am trying to use layout_constraintDimensionRatio and layout_constraintWidth_percent attribute together in an ImageView, but I find that they cannot be able to work together.</p>
  
  <p>My xml code is:</p>
  
  <h2>1.using layout_constraintWidth_percent only:</h2>
  
  <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"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
      &lt;ImageView
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:scaleType="fitXY"
          app:layout_constraintWidth_percent="0.5"
          app:layout_constraintLeft_toLeftOf="parent"
          app:layout_constraintTop_toTopOf="parent"
          app:srcCompat="@mipmap/ic_launcher"/&gt;
  &lt;/android.support.constraint.ConstraintLayout&gt;
  </code></pre>
  
  <p>its corresponding UI is:
  <a href="https://i.stack.imgur.com/N2Soq.png" rel="nofollow noreferrer">layout_constraintWidth_percent_only.png</a></p>
  
  <h2>2.using layout_constraintWidth_percent and layout_constraintDimensionRatio:</h2>
  
  <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"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
      &lt;ImageView
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          app:layout_constraintDimensionRatio="w,2:1"
          android:scaleType="fitXY"
          app:layout_constraintWidth_percent="0.5"
          app:layout_constraintLeft_toLeftOf="parent"
          app:layout_constraintTop_toTopOf="parent"
          app:srcCompat="@mipmap/ic_launcher"/&gt;
  &lt;/android.support.constraint.ConstraintLayout&gt;
  </code></pre>
  
  <p>its corresponding UI is:
  <a href="https://i.stack.imgur.com/afA3z.png" rel="nofollow noreferrer">layout_constraintWidth_percent_and_layout_constraintDimensionRatio.png</a></p>
  
  <p>It's clear that when I use layout_constraintDimensionRatio, layout_constraintWidth_percent does not work.</p>
  
  <p>What I really want is the width of the ImageView is 50% of its parent, and then the height of the ImageView is 50% of its width by using layout_constraintWidth_percent and layout_constraintDimensionRatio together.</p>