title: Splitting Android Layout Vertically Adding Gravity To Both Sides To Center Objects
body: <p>I have an android layout I'd like to split down the middle vertically and then add gravity so I can center items within the left and the right halves of the layout. </p>
  
  <p>Can someone explain or post an example of how this might be accomplished?</p>
  
  <p>Thus far I've created a layout and a horizontal layout. My problem is the horizontal layout needs balance so I'd like to figure out a way to change my current layout (show below) to include a way of centering the objects within the left and right halves of the screen. </p>
  
  <p>SOURCE:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@drawable/background"
      android:orientation="vertical" &gt;
  
       &lt;ImageView
           android:id="@+id/emblem"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:layout_alignParentLeft="true"
           android:layout_alignParentTop="true"
           android:layout_marginTop="24dp"
           android:gravity="center"
           android:scaleType="fitStart"
           android:src="@drawable/apn_app_logo" /&gt;
  
       &lt;Button
           android:id="@+id/go_button"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:layout_alignBottom="@+id/emblem"
           android:layout_alignParentRight="true"
           android:layout_marginBottom="23dp"
           android:layout_marginRight="22dp"
           android:background="@drawable/apn_app_go_button" /&gt;
  
       &lt;TextView
           android:id="@+id/text"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:layout_alignParentRight="true"
           android:layout_below="@+id/go_button"
           android:gravity="center"
           android:text="@string/start_text2"
           android:textColor="#000000"
           android:textSize="18sp" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>