title: Center layout Android
body: <p>How can I center these buttons on Android?
  <img src="https://i.stack.imgur.com/QjCIj.png" alt="alt text"></p>
  
  <p>The code I'm using in the <code>layout</code> is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"&gt;
  
        &lt;TextView android:layout_width="fill_parent" 
             android:layout_height="wrap_content" 
             android:text="@string/hello" /&gt;
  
        &lt;LinearLayout android:layout_width="fill_parent"
             android:layout_height="fill_parent"
             android:orientation="horizontal"&gt;
  
             &lt;Button android:text="Test"
                  android:layout_width="100px"
                  android:layout_height="40px" /&gt;
             &lt;Button android:text="Test"
                  android:layout_width="100px"
                  android:layout_height="40px" /&gt;
             &lt;Button android:text="Test"
                  android:layout_width="100px"
                  android:layout_height="40px" /&gt;
             &lt;Button android:text="Test"
                  android:layout_width="100px"
                  android:layout_height="40px" /&gt;
        &lt;/LinearLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>