LinearLayout скрыт MapView в RelativeLayout - PullRequest
       36

LinearLayout скрыт MapView в RelativeLayout

0 голосов
/ 18 февраля 2012

У меня есть RelativeLayout, в котором MapView. Сейчас я пытаюсь установить LinearLayout над этим MapView, так что я имею в виду сверху, но MapView должен заполнить весь экран.

Проблема в том, что теперь отображается MapView, но LinearLayout с идентификатором "map_zoomcontrols" скрыто .

Есть ли способ вывести LinearLayout на передний план?

<?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">
    <LinearLayout 
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/map_zoomcontrols"         
        android:layout_width="200dp" 
        android:layout_height="150dp" 
        android:layout_alignParentTop="true" 
        android:layout_centerHorizontal="true" 
        android:background="#fff"
        android:gravity="center_horizontal"> 
<Button 
    android:id="@+id/map_zoom_out"
    android:layout_width="70dp"
    android:layout_height="30dp"
    android:text="Out"
    android:textColor="#fff"
        android:background="#fff"
    />
<Button 
    android:id="@+id/map_zoom_in"
    android:layout_width="70dp"
    android:layout_height="30dp"
    android:text="In"
    android:textColor="#fff"
        android:background="@drawable/button_shape_selector"
    />

</LinearLayout>
<com.google.android.maps.MapView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mapview"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clickable="true"
    android:apiKey="..."/>



<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/bottom_ll"     
    android:orientation="horizontal"
    android:layout_width="400dp"
    android:layout_height="45dp"
    android:gravity="center_horizontal"
    android:background="@drawable/gradient"
    android:layout_alignParentBottom="true"
    >
    <Button android:id="@+id/btn_bottom"
            android:layout_width ="120dp"
            android:layout_height="35dp"
            android:layout_marginLeft="5dp"
            android:layout_marginTop="5dp"
            android:text="Bottom"
            android:textColor="#fff"
            android:background="@drawable/button_shape_selector"/>
</LinearLayout>             

1 Ответ

4 голосов
/ 18 февраля 2012

Поместите LinearLayout после элемента управления MapView в макете XML:

<?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
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/mapview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:clickable="true"
        android:apiKey="..."/>


      <LinearLayout 
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/map_zoomcontrols"         
            android:layout_width="200dp" 
            android:layout_height="150dp" 
            android:layout_alignParentTop="true" 
            android:layout_centerHorizontal="true" 
            android:background="#fff"
            android:gravity="center_horizontal"> 
    <Button 
        android:id="@+id/map_zoom_out"
        android:layout_width="70dp"
        android:layout_height="30dp"
        android:text="Out"
        android:textColor="#fff"
            android:background="#fff"
        />
    <Button 
        android:id="@+id/map_zoom_in"
        android:layout_width="70dp"
        android:layout_height="30dp"
        android:text="In"
        android:textColor="#fff"
            android:background="@drawable/button_shape_selector"
        />

    </LinearLayout>

<LinearLayout 
    android:id="@+id/bottom_ll"     
    android:orientation="horizontal"
    android:layout_width="400dp"
    android:layout_height="45dp"
    android:gravity="center_horizontal"
    android:background="@drawable/gradient"
    android:layout_alignParentBottom="true"
    >
    <Button android:id="@+id/btn_bottom"
            android:layout_width ="120dp"
            android:layout_height="35dp"
            android:layout_marginLeft="5dp"
            android:layout_marginTop="5dp"
            android:text="Bottom"
            android:textColor="#fff"
            android:background="@drawable/button_shape_selector"/>
</LinearLayout>             
...