Android: layout_gravity center does not center
<p>I have a problem, that is maybe silly, but I just can't figure out why this is not working.</p>

<p>Basically, I have a header in my activity. This header should be centered.</p>

<p>Layout-XML</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" &gt;

&lt;TextView 
    style="@style/TextHeader"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/define"
    /&gt;
&lt;/LinearLayout&gt;
</code></pre>

<p>Definition in styles.xml</p>

<pre><code>&lt;style name="TextHeader"&gt;
    &lt;item name="android:textSize"&gt;20dp&lt;/item&gt;
    &lt;item name="android:paddingTop"&gt;15dp&lt;/item&gt;
    &lt;item name="android:layout_gravity"&gt;center&lt;/item&gt;
    &lt;item name="android:paddingBottom"&gt;15dp&lt;/item&gt;
&lt;/style&gt;
</code></pre>

<p>As I understand, <code>layout_gravity</code> defines the gravity of the component itself, while <code>gravity</code> defines the gravity of the content of this component. I tried both ways, both with <code>center</code> and center_horizontal. I also made the header TextView <code>layout_width:wrap_content</code> and tried to center it with <code>layout_gravity</code>, but the result is always following (same thing if I put the app on my phone)</p>

<p><img src="http://i.stack.imgur.com/4tJmK.png" alt="enter image description here"></p>

<p>why is this so? how can I fix it?</p>
