2010-08-21 2 views
1

Часть моего макета показана ниже, но кнопка показывает выше 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 

Это был бы пойман во время компиляции, но вы поставили + знак на обоих. Это одна из причин, по которой я пытаюсь придерживаться правила «поставить знак + только на первое вхождение».

EDIT

Этот макет работает (хотя вам нужно заменить ваш ключ 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> 
Смежные вопросы