title: Add a Textview to a FrameLayout in a determined position
body: <p>I'm trying to add a <code>textView</code> to a <code>frameLayout</code>. The <code>TextView</code> has <code>wrap_content</code> properties, so it grows when the text grows. I'm adding it to a <code>FrameLayout</code> with this function:</p>
  
  <pre><code>((FrameLayout) findViewById(R.id.mainLayout)).addView(mEditText);
  </code></pre>
  
  <hr>
  
  <p>This is the xml of the frame layout:</p>
  
  <pre><code>&lt;FrameLayout  
  xmlns:android="http://schemas.android.com/apk/res/android" 
  android:id="@+id/mainLayout"
  android:layout_width="wrap_content"  
  android:layout_height="wrap_content"&gt; 
  &lt;/FrameLayout&gt;
  </code></pre>
  
  <p>The textView always appears in the top left corner of the screen. I'd like to position it in the middle, or top middle. How can this be done?<br>
  I looked over the answers in <a href="https://stackoverflow.com/questions/6535648/how-can-i-dynamically-set-the-position-of-view-in-android">How can I dynamically set the position of view in Android?</a> and they weren't much help :( Mainly caused crashes.. </p>