title: Android - Setting TextView as Wrap_Content Programmatically Doesn't Work
body: <p>I used the following code to make a <code>TextView</code> programmatically:</p>
  
  <pre><code>RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
  params.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
  params.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
  someRelativeLayout.addView(someTextView, params);
  </code></pre>
  
  <p>When I look at the TextView after its creation, however, it looks cut off. I've tried decreasing the font size, but it's still cut off. Size doesn't seem to be a factor.</p>
  
  <p>I tried setting the width to <code>LayoutParams.MATCH_PARENT</code>, which does allow the entire word to be displayed, but it seemed to have nullified the effects of <code>RelativeLayout.CENTER_HORIZONTAL</code> because it then got aligned to the left of the <code>RelativeLayout</code>.</p>
  
  <p>How do I make it so that it would be truly content-wrapped and horizontally-centered within the layout?</p>