title: Setting background color of RelativeLayout in Xamarin.Android
body: <p>I am trying to add a background color to the search form area of a RelativeLayout in my Android app in Xamarin. Basically I have an EditText and a button that should be contained within a colored background at the top of the screen. Using the code below, the background color is applied but my EditText and button disappear while the content below them move up and take their place. Here's my code:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:pixlui="http://schemas.android.com/apk/com.neopixl.pixlui"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:screenOrientation="portrait"
    android:background="#ffffff"&gt;
  
    &lt;RelativeLayout
    android:id="@+id/TestLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#EAF4F9"&gt;
  
      &lt;com.neopixl.pixlui.components.textview.TextView
      android:id="@+id/textView1"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="My Heading"
      pixlui:typeface="Lato-Bold.ttf"
      android:layout_marginBottom="15dp"/&gt;
  
      &lt;EditText
      android:inputType="numberDecimal"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_below="@+id/textView1"
      android:id="@+id/SearchField"
      android:layout_marginRight="10dp"/&gt;
  
      &lt;Button
      android:text="Search"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_below="@id/textView1"
      android:layout_toRightOf="@id/SearchField"
      android:id="@+id/btnSearch"
      android:layout_alignParentRight="true" /&gt;
  
      &lt;TextView
      android:text="Use my current location"
      android:layout_width="wrap_content"
      android:layout_height="20dp"
      android:layout_below="@id/SearchField"
      android:id="@+id/txtCurrentLocation"
      android:gravity="center"/&gt;
  
    &lt;/RelativeLayout&gt;
  
    &lt;View
    android:id="@+id/strut"
    android:layout_width="0dp"
    android:layout_height="0dp"
    android:layout_centerHorizontal="true" /&gt;
  
    &lt;com.neopixl.pixlui.components.button.Button
    android:id="@+id/btnOne"
    android:text="Button One"
    android:layout_width="0dp"
    android:layout_height="100dp"
    android:layout_alignRight="@id/strut"
    android:layout_alignParentLeft="true"
    android:layout_below="@id/txtCurrentLocation"
    pixlui:typeface="Lato-Light.ttf"
    android:gravity="center" /&gt;
  
    &lt;com.neopixl.pixlui.components.button.Button
    android:text="Button Two"
    android:id="@+id/btnTwo"
    android:layout_width="0dp"
    android:layout_height="100dp"
    android:layout_alignLeft="@id/strut"
    android:layout_alignParentRight="true"
    android:layout_below="@id/txtCurrentLocation"
    android:gravity="center"
    pixlui:typeface="Lato-Light.ttf" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Should I be utilizing a LinearLayout here instead or is there a better way to construct this?</p>