title: How to create a vertical line programmatically?
body: <p>I want to create a layout like below with <code>LinearLayout</code>:</p>
  
  <p><img src="https://i.stack.imgur.com/t03il.png" alt="enter image description here"></p>
  
  <p>The problem is that I see all the components except the red vertical line. How can I add this line programmatically?  </p>
  
  <p>Here is the my code:</p>
  
  <pre><code>public class TextLinear extends LinearLayout {
  
          mainLinearLayout= new LinearLayout(mcontext);
          linearSocial= new LinearLayout(mcontext);
          linearSocial.setOrientation(LinearLayout.HORIZONTAL);
  
          lLayout = new LinearLayout(mcontext);
          tViewTitle = new TextView(mcontext);
          tvMessageFire = new TextView(mcontext);
  
          viewDivider = new View(mcontext);
          viewDivider.setLayoutParams(new LayoutParams(5,LayoutParams.WRAP_CONTENT));
          viewDivider.setBackgroundColor(Color.RED);
  
          img0=new ImageView(mcontext);
          img1=new ImageView(mcontext);
  
          linearSocial.addView(img0);
          linearSocial.addView(img1);
          linearSocial.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT,Gravity.RIGHT));
  
          lLayout.addView(tViewTitle);
          lLayout.addView(tvMessageFire);
          lLayout.addView(linearSocial,rightGravityParams);
  
          mainLinearLayout.addView(lLayout);
  
          this.addView(mainLinearLayout);
          this.addView(viewDivider);
      }
  </code></pre>
  
  <p>Full code here: <a href="http://pastebin.com/gxySsKZ1" rel="nofollow noreferrer">http://pastebin.com/gxySsKZ1</a></p>