Center a layout in Android?
<p>I have a linear layout, how can I add gravity to it so that it is horizontally centred?</p>

<pre><code>LinearLayout textHolder = new LinearLayout(context);
 textHolder.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL);
</code></pre>

<p>The above does not appeat to work.</p>
