title: Gravity property of TextView in xml does not center the text
body: <p>I have a <code>TextView</code> in a <code>LinearLayout</code>, width is set to <code>fill_parent</code> and height is set to <code>wrap_content</code>. When I apply the <code>android:gravity="center"</code> property in the <code>TextView</code>, then, instead of aligning text to <code>center</code>, the text begins from center. Moreover, when the <code>gravity</code> property is set to <code>"right"</code>, the text disappears, ie, it begins from the right end. I just started with learning android and I am just a beginner. I googled, searched on this forum, but could not find the solution. Please Help. My xml code looks like this:</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
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:text="Text View"
      android:textSize="45dp"
      android:layout_gravity="center"
      android:gravity="center" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>I know that changing the <code>layout_width</code> to <code>wrap_content</code> will solve the problem, but I want to know why this method isn't working. Because, this will solve the problem in the case of <code>TextView</code>, but it will stay a problem when working with <code>Button</code> as I wont be able to align the text in it.</p>
  
  <p>Thanks in Advance.</p>