title: add Dynamic child views vertically to ConstraintLayout
body: <p>Android <code>ViewGroup</code> has the following methods to add (child) Views:</p>
  
  <p><a href="https://i.stack.imgur.com/U5534.png" rel="noreferrer"><img src="https://i.stack.imgur.com/U5534.png" alt="enter image description here"></a></p>
  
  <p>I know we can easily define horizontal/vertical orientation to LinearLayout in xml/programatically and add child views, eg. </p>
  
  <p><a href="https://i.stack.imgur.com/v8G1J.png" rel="noreferrer"><img src="https://i.stack.imgur.com/v8G1J.png" alt="enter image description here"></a></p>
  
  <p>Similarly with RelativeLayout, we can use <code>ViewGroup</code>'s <code>addView</code> and <code>RelativeLayout.LayoutParams</code>'s method: </p>
  
  <p><a href="https://i.stack.imgur.com/Gugyi.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Gugyi.png" alt="enter image description here"></a></p>
  
  <p>I am also aware that we can use <code>LinearLayout</code> as a child inside <code>ConstraintLayout</code> and play with it.</p>
  
  <p>Is there any solid and recommended way to add child views to ConstraintLayout dynamically?</p>
  
  <p><strong>UPDATE</strong>:
  Let me give a not-so-simple example which I what I want to achieve.</p>
  
  <p>Suppose you have a <code>View</code>1, <code>View</code>2 and <code>View</code>3. All V1, V2 and V3 are aligned vertically one below another and are complex views consisting of multiple <code>TextView</code>s and <code>ImageView</code>s. Based on user action and what server sends information, I need to add multiple V1 and V2 (can be 1 pair of V1-V2 and can be 3 pairs of V1-V2)between original V2 and V3. If I am using ConstraintLayout, would it be best if I add multiple constraints programatically when I can easily use LinearLayout with vertical orientation?</p>
  
  <p>Now, in terms of efficiency, performance and less-and-beautiful-code, is ConstraintLayout best for this requirement as compared to Linear Layout?</p>