title: How set the android:gravity to TextView from Java side in Android
body: <p>I can use <code>android:gravity="bottom|center_horizontal"</code> in xml on a textview to get my desired results, but I need to do this programmatically. My textview is inside a <code>tablerow</code> if that matters in a <code>relativelayout</code>.</p>
  
  <p>I have tried:</p>
  
  <pre><code>LayoutParams layoutParams = new TableRow.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL);
  labelTV.setLayoutParams(layoutParams);
  </code></pre>
  
  <p>But if I understand correctly, that would apply it to the <code>tablerow</code>, not the textview?</p>