Set the marker icon in the Google Maps API.

I use Xamarin and use SimpleMapDemo, and I have a question that the MarkerOptions object has a different icon.

Here is my current code:

marker1.Icon(SetFeatureDrawable('Icon.png'));

This code does not work.

Can I please help set the icon as an icon, which is located in the Drawable folder with the name "Icon.png"?

Thank you in advance

EDIT

Here is my code:

marker1.Icon(BitmapDescriptorFactory.FromResource(Resource.Drawable.monkey));

This is the error I get:

Non-invocable member 'Android.Gms.Maps.Model.MarkerOptions.Icon' cannot be used like a method

Here is my code to try installing the icon:

marker1.Icon = BitmapDescriptorFactory.FromResource(Resource.Drawable.monkey);

This is the error I get:

CS0200: Property or indexer 'Android.Gms.Maps.Model.MarkerOptions.Icon' cannot be assigned to -- it is read only (CS0200)
+4
source share
3 answers

Try using this code:

marker1.InvokeIcon(SetFeatureDrawable('Icon.png'));

, Xamarin /getter Java . , MarkerOption.icon #, Java. "" , Java, MarkerOption.InvokeIcon #.

+3

:

double latitude = 0.0;
double longitude = 0.0;

MarkerOptions mapMarker = new MarkerOptions().position(new LatLng(latitude, longitude)).title("Your title will be here");

mapMarker .icon(BitmapDescriptorFactory.fromResource(R.drawable.icon)));

mapView.addMarker(mapMarker );
+2

, , , ,

    MarkerOptions markerOptions = new MarkerOptions();

    // Setting position on the MarkerOptions
    markerOptions.SetPosition(lt);
    markerOptions.InvokeIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.pin));

custom map marker in google map

+2

All Articles