title: Right align TextView using gravity in RelativeLayout
body: <p>I am trying to get an editText to sit on the right edge of my layout, with a button to its left, as follows:</p>
  
  <pre><code>  &lt;RelativeLayout
      android:id="@+id/FindClientLayout"
      android:layout_width="@dimen/third_width"
      android:layout_height="@dimen/half_height"
      android:layout_alignParentLeft="false"
      android:layout_alignParentRight="true"
      android:layout_alignParentTop="false"
      android:layout_below="@id/HeaderLayout"
      android:layout_margin="@dimen/fragment_separation"
      android:layout_toRightOf="@id/scrollViewRecommend"
      android:background="@drawable/login_border" &gt;
  
      &lt;TextView
          android:id="@+id/textViewFindClient"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentRight="true"
          android:layout_alignParentTop="true"
          android:text="@string/find_client"
          android:textAppearance="?android:attr/textAppearanceLarge"
          android:textColor="@color/Black" /&gt;
  
      &lt;EditText 
          android:id="@+id/editTextClient"
          android:layout_width="@dimen/input_text_width"
          android:layout_height="wrap_content"
          android:gravity="center_vertical|right"
          android:inputType="text"/&gt;
      &lt;Spinner
          android:id="@+id/spinnerClientList"
          android:layout_width="@dimen/input_text_width"
          android:layout_height="wrap_content"
          android:layout_below="@id/editTextClient"/&gt;
  
      &lt;Button
          android:id="@+id/buttonDoFind"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:gravity="center_vertical"
          android:layout_toLeftOf="@id/editTextClient"
          android:text="@string/find" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>The button is invisible, and the result looks like this:</p>
  
  <p><img src="https://i.stack.imgur.com/42Hsr.png" alt="Layout"></p>
  
  <p>I assume the button is invisible because the editText is left-aligned and overlays it or pushes it out of the layout frame. Why is are the editText and spinner left aligned rather than right-aligned? Also, why is the editText not centered vertically?</p>