title: how to set alignment of views in relative layout using java code in android
body: <p>how to set the alignment of views in the relative layout using java code in android </p>
  
  <p>I know how to do in XML                                                       </p>
  
  <pre><code>android:layout_alignLeft="@id/button1"
  android:layout_alignParentLeft="@id/button2"
  </code></pre>
  
  <p>but, I want to know how to write using java code?
  My Problem is to 
  I want to align one TextView to right and ImageView to left inside a RelativeLayout.
  How to do that?</p>