android谷歌地图将MyLocation图标更改为Material图标

android谷歌地图将MyLocation图标更改为Material图标,android,google-maps,Android,Google Maps,我在我的android应用程序中使用谷歌地图API,我想将我的位置按钮的外观从带有方形的旧按钮更改为新的圆形材质设计图标 当前一个: 我想换成这个: 另外,如何将其位置从右上角更改为右下角 下面是我的XML文件代码: <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_wi

我在我的android应用程序中使用谷歌地图API,我想将我的位置按钮的外观从带有方形的旧按钮更改为新的圆形材质设计图标

当前一个:

我想换成这个:

另外,如何将其位置从右上角更改为右下角

下面是我的XML文件代码:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.bhoiwala.locationmocker.MapsActivity" >
  <fragment xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:map="http://schemas.android.com/apk/res-auto"
  xmlns:tools="http://schemas.android.com/tools"
  android:id="@+id/map"
  android:name="com.google.android.gms.maps.SupportMapFragment"
  android:layout_width="match_parent"
  android:layout_height="wrap_content" />
</FrameLayout>    
谢谢:)

您可以更改为

 mMap.setMyLocationEnabled(false);

创建自己的图标并更改单击事件的位置。在地图的latLng points中添加标记。将自定义图像粘贴到drawable文件夹中 那就这样打电话吧

Marker marker = mMap.addMarker(new MarkerOptions().position( latLng).icon(BitmapDescriptorFactory.fromResource(R.drawable.customicon)));

当你在API>21上运行代码时,它会显示材质设计mylocation图标。我想指出的是,在调用mMap.setMyLocationEnabled(false)后,你可以简单地禁用UI中的按钮;因此:mMap.getUiSettings().setMyLocationButtonneEnabled(false);这有效地隐藏了按钮,同时仍然允许您在自己的fab onclick中启动/停止位置更新
Marker marker = mMap.addMarker(new MarkerOptions().position( latLng).icon(BitmapDescriptorFactory.fromResource(R.drawable.customicon)));