title: How do I create a constraint layout programmatically
body: <p>I am new to constraint layout and have a hard time figuring out how to create it programmatically.</p>
  
  <p>Here's my xml code for it:</p>
  
  <pre><code>&lt;RelativeLayout
          android:id="@+id/ShareContainer"
          android:layout_width="0dp"
          android:layout_height="0dp"
          android:layout_marginTop="0dp"
          android:layout_marginBottom="0dp"
          app:layout_constraintDimensionRatio="16:9"
          app:layout_constraintLeft_toLeftOf="parent"
          app:layout_constraintRight_toRightOf="parent"
          app:layout_constraintTop_toBottomOf="@+id/StatusContainer"
          app:layout_constraintBottom_toTopOf="@+id/ButtonContainer"&gt;
  
          &lt;com.myapp.ui.testLayout
              android:id="@+id/ShareVideo"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:background="@color/black"/&gt;
  
          &lt;ImageButton
              android:id="@+id/ShareToggle"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignParentBottom="true"
              android:layout_alignParentRight="true"
              android:layout_marginBottom="36dp"
              android:layout_marginLeft="16dp"
              android:background="@android:color/transparent"
              android:src="@drawable/ic_video_cam_switch" /&gt;
      &lt;/RelativeLayout&gt; 
  </code></pre>
  
  <p>e.g. what are the code equivalents of </p>
  
  <pre><code>app:layout_constraintDimensionRatio, app:layout_constraintLeft_toLeftOf, 
  app:layout_constraintRight_toLeftOf, app:layout_constraintTop_toBottomOf, 
  app:layout_constraintBottom_toTopOf, etc
  </code></pre>