How to replace blue dot with my icon on google map

2020-03-24 07:56发布

I am trying to replace blue dot (which shown current location on maps) with my own icon on Google maps v2. I have tried below, none worked.

Should look like this this

Below did not work

Bitmap b = BitmapFactory.decodeResource(getResources(),
        R.drawable.location_arrow1);
googleMap.addMarker(new MarkerOptions().position(myPosition)
        .title(getIntent().getStringExtra("first_name"))
        .icon(BitmapDescriptorFactory.fromBitmap(b)));

2条回答
Luminary・发光体
2楼-- · 2020-03-24 08:26

I think you pass your current location to LocationSource to be able to use the my-location button.

You have to do that on your own. - set to false gmaps.getUiSettings().setMyLocationButtonEnabled(false);

  • create your own location button
  • if you get your current location, set a marker with your icon on that
  • if you click on your location button, move the camera and center it to the map
查看更多
神经病院院长
3楼-- · 2020-03-24 08:28

You will have to stop using GoogleMap.setMyLocationEnabled and write a bit more code, including receiving location updates on your own and adding Circle for accuracy.

查看更多
登录 后发表回答