Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Custom marker icon

Tags:

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!

like image 499
Jamel Naghmouchi Avatar asked Apr 09 '12 17:04

Jamel Naghmouchi


People also ask

How do I start a custom image on Google Maps marker for mobile app?

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.


1 Answers

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.

like image 66
Janusz Avatar answered Oct 05 '22 09:10

Janusz