Changing colour of Markers - Google Map V2 Android

前端 未结 3 841
遇见更好的自我
遇见更好的自我 2021-02-05 00:06

I\'m having a little trouble understanding how to change the colour of a marker in an Android Google Map project.

My code for a Marker is:

googlemap.addM         


        
相关标签:
3条回答
  • 2021-02-05 00:37

    The problem is the semicolon ";" on the end of the line

    .setSnippet("and snippet");
    

    If you delete the semicolon making it

    .setSnippet("and snippet")
    

    It should work.

    0 讨论(0)
  • 2021-02-05 00:38

    You have a couple of characters wrong there. Compare your code to this:

    googlemap.addMarker(new MarkerOptions()
        .position(new LatLng( 65.07213,-2.109375))
        .title("This is my title")
        .snippet("and snippet")
        .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_ORANGE)));
    

    Removed ) on third line, changed setSnippet to snippet and removed ; on forth line.

    0 讨论(0)
  • 2021-02-05 00:47
    {
        googleMap.addMarker(new MarkerOptions()
             .position(new LatLng(19.01062463, 73.01141475))
             .title("Point1").snippet("Speed=1.2")
             .icon(bitmapDescriptorFromVector(context, R.drawable.ic_icon)));
    }
    
    googleMap.addMarker(new MarkerOptions()
        .position(new LatLng(19.02369039, 73.00778391))
        .title("Point2")
        .snippet("Speed2=0.42").icon(bitmapDescriptorFromVector(context, R.drawable.ic_icon)));
    
    0 讨论(0)
提交回复
热议问题