Android Google Maps API v2 - how to change marker icon

后端 未结 8 1149
青春惊慌失措
青春惊慌失措 2021-01-31 16:34

I am trying to change marker icon. I get the image from one server directory.

When I put break point every time the \"bit\" result is null. And when I run t

8条回答
  •  说谎
    说谎 (楼主)
    2021-01-31 16:52

    // latitude and longitude
    double latitude = 17.385044;
    double longitude = 78.486671;
    
    // create marker
    MarkerOptions marker = new MarkerOptions().position(new LatLng(latitude, longitude)).title("Hello Maps");
    
    // Changing marker icon
    marker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.my_marker_icon)));
    
    // adding marker
    googleMap.addMarker(marker);
    

    More Info

提交回复
热议问题