title: How to programmatically set the layout_align_parent_right attribute of a Button in Relative Layout?
body: <p>I have a relative layout which I am creating programmatically:</p>
  
  <pre><code> RelativeLayout layout = new RelativeLayout( this );
      RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT,
              LayoutParams.WRAP_CONTENT);
  </code></pre>
  
  <p>Now I have two buttons which I want to add in this relative layout. But the problem is both buttons are being shown on the left of the RelatiiveLayout overlapping on each other. </p>
  
  <pre><code>buttonContainer.addView(btn1);
  buttonContainer.addView(btn2);
  </code></pre>
  
  <p>Now I want to know how can I programmatically set the the <code>android:layout_alignParentRight="true</code>"
  or  <code>android:layout_toLeftOf="@id/btn"</code> attribute of buttons as we do in the xml?</p>