title: why i can't make my buttons centered horizontally in table layout
body: <p>what i have is buttons that i have inserted them in table layout and each button has a background image and i have tried all of the ways to make the button centered in each row but it didn't work .. here is my xml code:</p>
  
  <pre><code> &lt;android.support.v4.widget.DrawerLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/drawer_layout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@drawable/background"&gt;
     &lt;TableLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
           android:orientation="horizontal"
         &gt;
         &lt;TableRow
             android:id="@+id/tableRow1"
             android:layout_height="wrap_content"
            android:layout_width="wrap_content"
             android:layout_marginBottom="20sp"
              android:layout_marginTop="20sp"
             android:layout_gravity="center"
  
            &gt;
         &lt;Button
          android:id="@+id/button1"
          android:layout_width="170sp"
          android:layout_height="60sp"
  
          android:layout_gravity="center_horizontal"
          android:background="@drawable/zebra" 
  
         /&gt;
        &lt;/TableRow&gt;
         &lt;TableRow 
              android:id="@+id/tableRow2"
              android:layout_marginBottom="20sp"
                 android:layout_height="wrap_content"
            android:layout_width="wrap_content"
                 android:layout_gravity="center"&gt;
             &lt;Button
          android:id="@+id/button2"
          android:layout_width="170sp"
          android:layout_height="60sp"
          android:layout_gravity="center_horizontal"
          android:background="@drawable/roller" 
         /&gt;
    &lt;/TableRow&gt;
     &lt;TableRow
         android:id="@+id/tableRow3"
         android:layout_marginBottom="20sp"
            android:layout_gravity="center_horizontal"&gt;
      &lt;Button
          android:id="@+id/button3"
          android:layout_width="170sp"
          android:layout_height="60sp"
          android:layout_gravity="center_horizontal"
  
          android:background="@drawable/wooden" /&gt;
        &lt;/TableRow&gt;
         &lt;TableRow
             android:id="@+id/tableRow4"
             android:layout_marginBottom="20sp"
                android:layout_gravity="center_horizontal"&gt;
      &lt;Button
          android:id="@+id/button4"
          android:layout_width="170sp"
          android:layout_height="60sp"
         android:layout_gravity="center_horizontal"
  
          android:background="@drawable/roman" /&gt;
       &lt;/TableRow&gt;
      &lt;/TableLayout&gt;
  
  
      &lt;!-- Framelayout to display Fragments --&gt;
    &lt;FrameLayout
         android:id="@+id/frame_container"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:layout_alignParentLeft="true"
         android:layout_alignParentTop="true" &gt;
     &lt;/FrameLayout&gt;
      &lt;!-- Listview to display slider menu --&gt;
      &lt;ListView
          android:id="@+id/list_slidermenu"
          android:layout_width="240dp"
          android:layout_height="match_parent"
          android:layout_gravity="start"
          android:choiceMode="singleChoice"
          android:divider="#ffffff"
          android:dividerHeight="1dp"        
          android:listSelector="@drawable/list_selector"
          android:background="#703534"/&gt;
  &lt;/android.support.v4.widget.DrawerLayout&gt;
  </code></pre>