title: Xamarin Android - Set toolbar background as an image, not working as expected
body: <p>I want to set an image to be the background for my toolbar, with the image scaled to fit. For some reason the image just renders below the toolbar. and I am not sure why. Any help would be greatly appreciate. I have tried many of the ways people have suggested online and non of them yield the result I am looking for.</p>
  
  <p>Also: Setting the background programmatically has the same result.</p>
  
  <p>Here is my view code with the background set to the image</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:id="@+id/main_nav_drawer_layout"
      android:fitsSystemWindows="true"&gt;
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:orientation="vertical"&gt;
          &lt;android.support.v7.widget.Toolbar
              android:id="@+id/main_nav_toolbar"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:minHeight="?attr/actionBarSize"
              android:background="@drawable/header_bg"
              android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
              app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /&gt;
          &lt;FrameLayout
              android:id="@+id/app_fragment_container"
              android:layout_width="match_parent"
              android:layout_height="match_parent" /&gt;
      &lt;/LinearLayout&gt;
      &lt;android.support.design.widget.NavigationView
          android:layout_width="wrap_content"
          android:layout_height="match_parent"
          android:layout_gravity="start"
          android:id="@+id/main_nav_view"
          android:background="#D3D2D2"
          app:itemBackground="@drawable/style_menu_bg_color"
          app:menu="@menu/main_menu"
          app:headerLayout="@layout/main_menu_header"
          app:itemTextColor="@drawable/style_menu_text_color"
          app:itemIconTint="@drawable/style_menu_text_color" /&gt;
  &lt;/android.support.v4.widget.DrawerLayout&gt;
  </code></pre>
  
  <p>I have also tried it this way with an ImageView in the ToolBar</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:id="@+id/main_nav_drawer_layout"
      android:fitsSystemWindows="true"&gt;
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:orientation="vertical"&gt;
          &lt;android.support.v7.widget.Toolbar
              android:id="@+id/main_nav_toolbar"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:minHeight="?attr/actionBarSize"
              android:background="?attr/colorPrimary"
              android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
              app:popupTheme="@style/ThemeOverlay.AppCompat.Light"&gt;
            &lt;ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:src="@drawable/header_bg"/&gt;
          &lt;/android.support.v7.widget.Toolbar&gt;
          &lt;FrameLayout
              android:id="@+id/app_fragment_container"
              android:layout_width="match_parent"
              android:layout_height="match_parent" /&gt;
      &lt;/LinearLayout&gt;
      &lt;android.support.design.widget.NavigationView
          android:layout_width="wrap_content"
          android:layout_height="match_parent"
          android:layout_gravity="start"
          android:id="@+id/main_nav_view"
          android:background="#D3D2D2"
          app:itemBackground="@drawable/style_menu_bg_color"
          app:menu="@menu/main_menu"
          app:headerLayout="@layout/main_menu_header"
          app:itemTextColor="@drawable/style_menu_text_color"
          app:itemIconTint="@drawable/style_menu_text_color" /&gt;
  &lt;/android.support.v4.widget.DrawerLayout&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/ydhVQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ydhVQ.png" alt="enter image description here"></a></p>