title: How to center text - Eclipse for Android
body: <p>I have set up some text in a textView to explain the commands that the app responds to but the code gets formated (flattened) no matter what i type for gravity. The text is supposed to look like this :</p>
  
  <p>Commands and functions:</p>
  
  <ul>
  <li><strong>"left"</strong>- Sets tv gravity to left and changes text.</li>
  <li><strong>"right"</strong>- Sets tv gravity to right and changes text.</li>
  <li><strong>"center"</strong>- Sets tv gravity to center and changes text.</li>
  <li><strong>"blue"</strong>- sets tColor to BLUE.</li>
  <li><strong>"reset"</strong>- resets all tv properties to default</li>
  <li><strong>"WTF"</strong>- randomises tSize and tColour</li>
  </ul>
  
  <p>But instead turns out like this :</p>
  
  <p><img src="https://i.stack.imgur.com/zXWQH.png" alt="enter image description here"></p>
  
  <p>And here is my code(TextView is in a linear layout) :</p>
  
  <pre><code>&lt;TextView
      android:id="@+id/textView1"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:gravity="center"
      android:text="@string/tvTextPlayExplain" 
      android:typeface="serif"
      /&gt;
  </code></pre>