Skip to content

Instantly share code, notes, and snippets.

@mandhor
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mandhor/6adf9007eec8ec282ec5 to your computer and use it in GitHub Desktop.
Save mandhor/6adf9007eec8ec282ec5 to your computer and use it in GitHub Desktop.
Custom GoogleMap marker with text drawn
//add dependency: com.google.maps.android:android-maps-utils:0.3.4
GoogleMap map; //map reference
LatLng point; //LatLng point reference
String markerText = "123"; //text on marker
IconGenerator iconFactory = new IconGenerator(context);
iconFactory.setBackground(context.getResources().getDrawable(R.drawable.custom_marker));
iconFactory.setTextAppearance(context, R.style.custom_text_apperance);
Bitmap icon = iconFactory.makeIcon(markerText);
map.addMarker(new MarkerOptions()
.position(point)
.title("Title")
.icon(BitmapDescriptorFactory.fromBitmap(icon)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment