6

I'm working on a map that has multiple markers on it. These markers use a custom icon.

Is there a way to add numbers to these icons ?

edit: here is an example of what I want to do

enter image description here

I want to generate these icons programmatically and add them to the map.

Thanks

Nabil Echaouch
  • 108
  • 1
  • 7

1 Answers1

7

first, you can use library.

or, you should implement custom icons into drawable folder and put code below.

MarkerOptions markeropt = new MarkerOptions(); markeropt.snippet("Snippet"); markeropt.icon(BitmapDescriptorFactory.fromResource(R.drawable.custom_icon));

this solution would be helpful! here is a link's snippet.

Bitmap.Config conf = Bitmap.Config.ARGB_8888; 
Bitmap bmp = Bitmap.createBitmap(200, 50, conf); 
Canvas canvas = new Canvas(bmp);

canvas.drawText("TEXT", 0, 50, paint); // paint defines the text color, stroke width, size
mMap.addMarker(new MarkerOptions()
                                .position(clickedPosition)
                                //.icon(BitmapDescriptorFactory.fromResource(R.drawable.marker2))
                                .icon(BitmapDescriptorFactory.fromBitmap(bmp))
                                .anchor(0.5f, 1)
                                    );
Community
  • 1
  • 1
iroiroys
  • 788
  • 1
  • 10
  • 17