在地图上方添加按钮

时间:2014-03-26 16:07:23

标签: android xml google-maps button

我正在处理一个包含地图的活动,我试图在它上面添加按钮,这是我的xml看起来像

xml mock-up

这是我的xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/multi_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:orientation="horizontal" >

<FrameLayout
    android:id="@+id/container_a"
    android:layout_width="0dp"
    android:layout_height="match_parent"
    android:layout_weight="1" >
</FrameLayout>


<RelativeLayout
    android:layout_width="0dp"
     android:id="@+id/container_b"
    android:layout_height="match_parent"
    android:layout_weight="1" >

    <fragment
        android:id="@+id/map_fragment"
        android:name="com.google.android.gms.maps.SupportMapFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <RadioGroup
        android:id="@+id/radio_group_list_selector"
        android:layout_width="match_parent"
        android:layout_height="48dp"
        android:background="#80000000"
        android:orientation="horizontal"
        android:padding="4dp" >

        <Button
            android:id="@+id/driving"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="@drawable/bkg"
            android:drawableTop="@drawable/car"
            android:gravity="center_horizontal|center_vertical" />

        <Button
            android:id="@+id/radioAZ"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="@drawable/bkg"
            android:drawableTop="@drawable/walk"
            android:gravity="center_horizontal|center_vertical" />

        <Button
            android:id="@+id/bicycling"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="@drawable/bkg"
            android:drawableTop="@drawable/bicycle"
            android:gravity="center_horizontal|center_vertical" />
    </RadioGroup>
</RelativeLayout>

然而,当我运行应用程序时,该地图仍然位于按钮之上,任何人都知道如何将按钮放在地图上方以便用户可以查看和使用它们?沿着z-index线的东西?

1 个答案:

答案 0 :(得分:1)

您在XML上放置了SupportMapFragment,并将包含该片段的FrameLayout和带有其他片段的按钮替换为。