2010-08-21 50 views
1

我的佈局的一部分顯示如下,但Button顯示上方的 MapView和NOT在地圖的「下方」。我怎樣才能解決這個問題?無法在MapView下設置按鈕

<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" 
    /> 

回答

4

你的ID值是不一樣的:

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

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

那會已經陷入在編譯時間,但你把+牌子上都。這是我試圖堅持「僅在第一次出現時纔將+符號」的規則的原因之一。

編輯

這種佈局工作(雖然你將需要更換您的API密鑰):

<?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>