Google Map icon (pin) - how to define color?

后端 未结 2 1456
说谎
说谎 2021-01-12 19:25

is it possible to change color of pin placed on google map creatted by it\'s api? or have to use custom icon to do that?

it\'s google map api v3.

tnx in adv!

2条回答
  •  無奈伤痛
    2021-01-12 19:58

    I know this question is old, but if anyone just wants to change to pin or marker color, then check out the documentation: https://developers.google.com/maps/documentation/android-sdk/marker

    when you add your marker simply set the icon-property:

    GoogleMap gMap;
    LatLng latLng;
    ....
    // write your code...
    ....
    gMap.addMarker(new MarkerOptions()
        .position(latLng)
        .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN));
    

    There are 10 default colors to choose from.

提交回复
热议问题