views:

54

answers:

1

Part of my Layout is shown below, but the Button shows up above the MapView and NOT as expected "below" the map. How can I fix this?

   <RelativeLayout android:id="@android:id/tabcontent"
       android:layout_width="fill_parent"
       android:layout_height="fill_parent">
    <com.google.android.maps.MapView
        android:id="@+id/mapview1" android:layout_width="fill_parent"
        android:layout_height="fill_parent" android:clickable="true"
        android:apiKey="0i4xk7rTGI6b6ggDrC9hOYCbOd9julMg_DG79cg" />
    <Button android:id="@+id/btnBanner" 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text = "text"
        android:layout_below="@+id/mapView1"
     />
A: 

Your ID values are not the same:

android:id="@+id/mapview1"           // lowercase v

android:layout_below="@+id/mapView1" // uppercase V

That would have been caught at compile time, but you put the + sign on both. That's one reason I try to stick to the rule of "put the + sign only on the first occurrence".

EDIT

This layout works (though you'll need to replace your API key):

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <com.google.android.maps.MapView android:id="@+id/map"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:apiKey="..."
        android:layout_above="@+id/btnBanner"
        android:layout_alignParentTop="true"
        android:clickable="true" />
  <Button android:id="@id/btnBanner" 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:text = "text" />
</RelativeLayout>
CommonsWare