Last active
August 29, 2015 14:18
-
-
Save mandhor/6adf9007eec8ec282ec5 to your computer and use it in GitHub Desktop.
Custom GoogleMap marker with text drawn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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