本文整理汇总了C#中Android.Gms.Maps.Model.Marker.SetIcon方法的典型用法代码示例。如果您正苦于以下问题:C# Marker.SetIcon方法的具体用法?C# Marker.SetIcon怎么用?C# Marker.SetIcon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Gms.Maps.Model.Marker
的用法示例。
在下文中一共展示了Marker.SetIcon方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateImage
/// <summary>
/// Updates the image on a marker
/// </summary>
/// <param name="pin">The forms pin</param>
/// <param name="marker">The native marker</param>
private async Task UpdateImage(TKCustomMapPin pin, Marker marker)
{
BitmapDescriptor bitmap;
try
{
if (pin.Image != null)
{
var icon = await new ImageLoaderSourceHandler().LoadImageAsync(pin.Image, this.Context);
bitmap = BitmapDescriptorFactory.FromBitmap(icon);
}
else
{
if (pin.DefaultPinColor != Color.Default)
{
bitmap = BitmapDescriptorFactory.DefaultMarker((float)pin.DefaultPinColor.Hue);
}
else
{
bitmap = BitmapDescriptorFactory.DefaultMarker();
}
}
}
catch (Exception)
{
bitmap = BitmapDescriptorFactory.DefaultMarker();
}
marker.SetIcon(bitmap);
}
示例2: OnPinPropertyChanged
protected virtual void OnPinPropertyChanged(MapPin pin, Marker marker, PropertyChangedEventArgs e)
{
if (e.PropertyName == MapPin.ColorProperty.PropertyName)
{
marker.SetIcon(BitmapDescriptorFactory.DefaultMarker(pin.Color.ToAndroidMarkerHue()));
}
else if (e.PropertyName == MapPin.PositionProperty.PropertyName)
{
marker.Position = pin.Position.ToLatLng();
}
}
示例3: RefreshStation
private async void RefreshStation(Station station, Marker control)
{
try
{
station.IsUiRefreshNeeded = false;
// this can raise a IllegalArgumentException: Released unknown imageData reference
// as the marker may not be on the map anymore so better to check again for null ref
control.SetIcon(_clusterRender.CreateStationIcon(station));
}
catch
{
}
}