title: Android - positioning views programmatically
body: <p>I want to figure out how to position views programmatically in android. Lets say for example we have this XML code.</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent" 
  android:id="@+id/mainLayout"&gt;
  &lt;TextView
      android:id="@+id/textView1"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginLeft="121dp"
      android:layout_marginTop="140dp"
      android:text="Results" /&gt;&lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>How can I achieve this layout programmatically in android? because I want to have a random position of my textview. </p>