title: how to programmatically add a new relativelayout after another relativelayout without overlap?
body: <p>I tried to programmatically add a new relativelayout after another relativelayout without overlap.</p>
  
  <pre><code>    LinearLayout ll = (LinearLayout)findViewById(R.id.mainLL);
      ll.setOrientation(LinearLayout.VERTICAL);       
  
      RelativeLayout rl = new RelativeLayout(MainActivity.this);
      rl.setId(2);
      RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, 50);//RelativeLayout.LayoutParams.WRAP_CONTENT
      ll.addView(rl, lp);  
  
      TextView iTextView = new TextView(this);         
      iTextView.setTextSize(pthTextFontSize);
      iTextView.setText("ok"); 
      rl.addView(iTextView);       
      // finish adding the first relativelayout.
  
  
      RelativeLayout rl2 = new RelativeLayout(MainActivity.this);
      RelativeLayout.LayoutParams lp2 = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, 50);    
      lp2.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
      lp2.addRule(RelativeLayout.BELOW, rl.getId());
      rl2.setLayoutParams(lp2);
      ll.addView(rl2);
  
      TextView iTextView2 = new TextView(this);         
      iTextView2.setTextSize(pthTextFontSize);
      iTextView2.setText("abc"); 
      rl.addView(iTextView2);    
  </code></pre>
  
  <p>However, the word "ok" and "abc" are overlapped. Can anyone help me to check what is wrong?
  Thank a lot for help. </p>
  
  <p>In short:
  There is a linearlayout(occupied the full screen). Then I try to add two linearlayouts.The parent of relative layout "rl2" is "ll", and i tried to put "rl2" at ALIGN_PARENT_LEFT of "ll", and below "rl1", but they overlap.</p>