I'm working on application with Google maps so i want to define a custom marker for each custom place, For example (gas station- Hotel- Hospital.. ) ! i have a overlays class with the latitude and longitude of many places and i want just how to give a custom icon!
For adding a custom marker to Google Maps navigate to the app > res > drawable > Right-Click on it > New > Vector Assets and select the icon which we have to show on your Map. You can change the color according to our requirements. After creating this icon now we will move towards adding this marker to our Map.
With the new Maps Api Setting the Icon for a Marker is done with the following Code:
MarkerOptions markerOptions = new MarkerOptions().icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_location));
The icon can not be changed after a Marker was created. To change an icon remove the marker and readd it with a new image.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With