title: Center text in TextView and Button
body: <p>I am trying to center the text in my <code>TextView</code> and <code>Button</code>. I currently have the following code:</p>
  
  <pre><code>    &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      tools:context=".MainActivity" &gt;
  
      &lt;LinearLayout
          android:id="@+id/linearLayout1"
          android:layout_width="match_parent"
          android:layout_height="match_parent"        
          android:orientation="vertical"
          android:background="#000000" &gt;
  
          &lt;TextView
              android:id="@+id/textView1"
              android:layout_width="match_parent"
              android:layout_weight="0.15"
              android:layout_height="0dp"
              android:gravity="center"
              android:text="@string/CouponFinder"
              android:textSize="30sp"
              android:textColor="#FF0000"
              android:typeface="monospace" /&gt;
  
          &lt;ImageView
              android:id="@+id/couponImage"
              android:layout_width="match_parent"
              android:layout_weight="0.7"
              android:layout_height="0dp"
              android:src="@drawable/coupon" /&gt;
  
          &lt;Button
              android:id="@+id/button1"
              android:layout_width="match_parent"
              android:layout_weight="0.15"
              android:layout_height="0dp"
              android:text="@string/continueButton"
              android:textSize="30sp" 
              android:gravity="center"/&gt;
  
      &lt;/LinearLayout&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>However, the text in the <code>Button</code> and <code>TextView</code> are to the right and hence some of the text is off the screen... I am also getting the following warning for my <code>LinearLayout</code>:</p>
  
  <p><code>This LinearLayout layout or its RelativeLayout parent is possibly useless</code></p>
  
  <p>Any help would be greatly appreciated!!</p>