title: Relative Layout. Between 2 items
body: <p><img src="https://i.stack.imgur.com/9NjGz.png" alt="relative layout"></p>
  
  <p>How can I position an item between 2 other items and align it in the center? (please see the red button in the picture above) - How can I position it between the "Center Button" and "Bottom Button"?</p>
  
  <p>Here is my relative layout code:</p>
  
  <pre><code>&lt;RelativeLayout 
      xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_height="fill_parent" 
      android:layout_width="fill_parent"&gt; 
  
      &lt;Button 
          android:id="@+id/button_center" 
          android:text="Center" 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:layout_centerVertical="true" 
          android:layout_centerInParent="true"/&gt;
  
      &lt;!-- The new button should be between these 2 items --&gt;
  
      &lt;Button 
          android:id="@+id/button_bottom" 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:text="Bottom" 
          android:layout_centerHorizontal="true" 
          android:layout_alignParentBottom="true"/&gt; 
  
      &lt;Button 
          android:id="@+id/button_top" 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:text="Top" 
          android:layout_alignParentTop="true" 
          android:layout_centerHorizontal="true"/&gt; 
  
      &lt;Button 
          android:id="@+id/button_left" 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:text="Left" 
          android:layout_alignParentLeft="true" 
          android:layout_centerVertical="true"/&gt; 
  
      &lt;Button 
          android:id="@+id/button_rignt" 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:text="Right" 
          android:layout_alignParentRight="true" 
          android:layout_centerVertical="true"/&gt; 
  
      &lt;Button 
          android:id="@+id/button_rel_right" 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:layout_toLeftOf="@id/button_right" 
          android:layout_alignTop="@id/button_rignt" 
          android:text="RelRight"/&gt; 
  
      &lt;Button 
          android:id="@+id/button_rel_left" 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:layout_toRightOf="@id/button_left" 
          android:layout_alignTop="@id/button_left" 
          android:text="RelLeft"/&gt; 
  
  &lt;/RelativeLayout&gt; 
  </code></pre>