Add Gray Map Marker in Android Studio

2018-Jul-19
  1. Find a copy of one of Google map icons - this probably will be .png type:

                           

  2. Get it onto your system.

  3. Make sure the file name follows Android Studio's rules - ie. no hyphens.

  4. Open the file in your favourite paint program and change it to the color you want and save it without loosing its transparency. GIMP is a good for this.

  5. In Android Studio, right-click on res/drawable folder.

  6. Click on Show in Explorer.

  7. Go into drawable folder.

  8. Copy/paste your new icon into res/drawable folder - don't worry about it being a .png file while the others in the folder are .xml files.

  9. Close Explorer window.

  10. To use in your app - assuming the file name is gray_dot.png:

    mMarkerOptions.position(beachCoord).title("marker title").snippet("marker info").icon(BitmapDescriptorFactory.fromResource(R.drawable.gray_dot));

    When you are typing R.drawable.gray.. - it shows up without the .png extension.

  11. Run your app.

  12. Basic testing shows that the icon size works on a tablet and phone just fine without worrying about the different resolutions. I will do more testing to see if this remains true for higher resolutions.