如何添加谷歌材料图标;“我的位置”;在android的谷歌地图V2上?

如何添加谷歌材料图标;“我的位置”;在android的谷歌地图V2上?,android,android-studio,material-design,google-maps-android-api-2,Android,Android Studio,Material Design,Google Maps Android Api 2,我正在尝试使用API v2在android中显示地图 我想谷歌材料图标“我的位置”在地图上。但是,每当我尝试添加布局时,它都不会反映在输出中 我能够得到没有图标的地图。我需要图标与地图集成 当我在片段标记外部编写ImageButton代码时,图标显示在预览窗格中,但不在其内部 我应该把ImageButton代码放在哪里 Mylayout.xml的代码: <RelativeLayout android:layout_width="match_parent" android:l

我正在尝试使用API v2在android中显示地图

我想谷歌材料图标“我的位置”在地图上。但是,每当我尝试添加布局时,它都不会反映在输出中

我能够得到没有图标的地图。我需要图标与地图集成

当我在片段标记外部编写ImageButton代码时,图标显示在预览窗格中,但不在其内部

我应该把ImageButton代码放在哪里

Mylayout.xml的代码:

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

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

    <ImageButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/ic_gps"
        android:layout_alignParentTop="true"
        android:layout_alignParentRight="true"
        android:src="@drawable/ic_my_location_black_18dp" />
</RelativeLayout>

链接:-

获取地图对象(mMap)并在其上调用
setMyLocationEnabled(布尔值)

mMap.setMyLocationEnabled(true)

这将添加启动“查找我的位置”操作的默认图像按钮。

获取地图对象(mMap)并在其上调用
setMyLocationEnabled(布尔值)

mMap.setMyLocationEnabled(true)


这将添加启动“查找我的位置”操作的默认图像按钮。

您是指默认的“查找我的位置”按钮吗?您是指默认的“查找我的位置”按钮吗?