title: MapView Within LinearLayout
body: <p>I'm currently working on a small application that will allow a user to be presented with a Google map upon start. The screen should display a menu bar at the top, however when I run my app on any device, the map displays across the entire layout, overlaying the menu bar. </p>
  
  <p>How would I stop the fragment from overlapping my menu bar?</p>
  
  <p>Here is my current layout for the activity: </p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:map="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@color/dark_grey"
      android:orientation="vertical"
      android:weightSum="10"
      map:mapType="normal"
      tools:context=".Map" &gt;
  
      &lt;LinearLayout
          android:layout_width="fill_parent"
          android:layout_height="0dp"
          android:layout_weight="1"
          android:background="@color/white"
          android:orientation="horizontal"
          android:weightSum="3" &gt;
  
          &lt;ImageView
              android:id="@+id/imageView2"
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              android:src="@drawable/ic_launcher" /&gt;
  
          &lt;Spinner
              android:id="@+id/menuSpinner"
              android:layout_width="0dp"
              android:layout_height="fill_parent"
              android:layout_weight="2"
              android:entries="@array/menu_array"
              android:textSize="10sp" /&gt;
      &lt;/LinearLayout&gt;
  
      &lt;fragment
          android:id="@+id/map"
          android:name="com.google.android.gms.maps.MapFragment"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content" /&gt;
  
      &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>As you can see, the layout is fairly simple, just the menu bar as a LinearLayout, and the map as a fragment.</p>
  
  <p>The code for this is fairly simple as well, just setting up the spinner and initializing the map.</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(edu.wcu.trackerapp.R.layout.activity_map);
      // Initialize the spinner
      menu = (Spinner) findViewById(R.id.menuSpinner);
      // Set up the listener for the spinner.
      menu.setOnItemSelectedListener(this);
      try {
          // Loading map
          initializeMap();
      } catch (Exception e) {
          e.printStackTrace();
      }
  
  }
  
  /**
   * function to load map. If map is not created it will create it for you
   * */
  private void initializeMap() {
      if (googleMap == null) {
          googleMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
          if (googleMap == null) {
              Toast.makeText(getApplicationContext(),
                      "Sorry! unable to create maps", Toast.LENGTH_SHORT)
                      .show();
          } else {
              googleMap.setMyLocationEnabled(true);
              googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(
                      cullowLocation, 15));
          }
      }
  }
  </code></pre>
  
  <p>Lastly, here is a screenshot of the application running on the device, with the map code enabled. <img src="https://i.stack.imgur.com/QxBWb.jpg" alt="screenshot of map full-screen"> </p>