我需要自定义我的图钉/标记,我已经添加了所有需要它的渲染器和类,但我仍然不知道如何更改标记和放置图像。
我的问题是在地图实施中
CustomPin pin = new CustomPin
{
Type = PinType.Place,
Label = "Test pin",
Position = new Position(37.79752, -122.40183)
};
map.CustomPins = new List<CustomPin> { pin };
map.Pins.Add(pin);
我必须添加/更改什么才能将我已经在资源中拥有的图像作为此图钉的标记?
现在它只需要我作为 pin 的名为 pin.png 的图像,但有时还需要使用不同的图像
渲染器有这个:
protected override MarkerOptions CreateMarker(Pin pin)
{
var marker = new MarkerOptions();
marker.SetPosition(new LatLng(pin.Position.Latitude, pin.Position.Longitude));
marker.SetTitle(pin.Label);
marker.SetSnippet(pin.Address);
marker.SetIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.pin));
return marker;
}
直接选择Resource.Drawable.pin或许可以调用这个并改变它,但我不知道如何使用它。