本文整理汇总了C#中Android.Gms.Maps.Model.MarkerOptions.SetIcon方法的典型用法代码示例。如果您正苦于以下问题:C# MarkerOptions.SetIcon方法的具体用法?C# MarkerOptions.SetIcon怎么用?C# MarkerOptions.SetIcon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Gms.Maps.Model.MarkerOptions
的用法示例。
在下文中一共展示了MarkerOptions.SetIcon方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: addEvent
private void addEvent(net.cloudapp.geteventinfo.Eventas event1)
{
MarkerOptions marker = new MarkerOptions();
marker.SetPosition(new LatLng(event1.latitude, event1.longitude));
marker.SetTitle(event1.eventname);
marker.SetSnippet(event1.description);
marker.SetIcon(BitmapDescriptorFactory.FromAsset("f.png"));
gMap.AddMarker(marker);
}
示例2: PlaceMarkersOnTheMap
public static void PlaceMarkersOnTheMap(List<Feature> data, GoogleMap map)
{
foreach (var feature in data)
{
MarkerOptions wc = new MarkerOptions ();
znajdzwc.Models.Geometry g = feature.geometry;
Properties p = feature.properties;
wc.SetPosition (new LatLng (g.coordinates [1], g.coordinates [0]));
wc.SetTitle (p.name);
wc.SetSnippet (p.comment);
if(p.isFree)
wc.SetIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.znajdz_wc_logo_free));
else
wc.SetIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.znajdz_wc_logo_free_money));
map.AddMarker (wc);
}
}
示例3: InitMarkers
public void InitMarkers()
{
foreach (var element in ListMarkers) {
MarkerOptions markerOptions = new MarkerOptions ();
markerOptions.SetPosition (new LatLng (element.Coordinate.Latitude, element.Coordinate.Longitude));
markerOptions.SetIcon(BitmapDescriptorFactory.DefaultMarker ());
var marker = this.map.AddMarker (markerOptions);
this.listMarkers.Add (marker);
}
}
示例4: OnMapReady
public void OnMapReady (GoogleMap googleMap)
{
gMap = googleMap;
SetUpMapAllEvents ();
gMap.MapLongClick += (object sender, GoogleMap.MapLongClickEventArgs e) => {
MarkerOptions marker = new MarkerOptions();
marker.SetPosition(new LatLng(e.Point.Latitude, e.Point.Longitude));
marker.SetTitle("Kasis");
marker.SetIcon(BitmapDescriptorFactory.DefaultMarker (BitmapDescriptorFactory.HueCyan));
gMap.AddMarker(marker);
};
}
示例5: OnElementChanged
protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs<Xamarin.Forms.View> e)
{
base.OnElementChanged(e);
extendedMap = (ExtendedMap)Element;
mapView = Control as MapView;
map = mapView.Map;
map.MarkerClick+= HandleMarkerClick;
// Pin tıklanınca sağalta açılan menüyü engellemek için
map.UiSettings.MapToolbarEnabled = true;
map.UiSettings.MyLocationButtonEnabled = true;
if (extendedMap.isOverlayNeeded) {
LatLng southwest = new LatLng (extendedMap.sw.Latitude, extendedMap.sw.Longitude);
LatLng northeast = new LatLng (extendedMap.ne.Latitude, extendedMap.ne.Longitude);
LatLngBounds bounds = new LatLngBounds (southwest, northeast);
string url = extendedMap.overlayURL;//"http://www.mgm.gov.tr/mobile/mblhrt/data/radar/MAX--_6100_P00.png";
Bitmap objBitmap = GetImageBitmapFromUrl (url);
BitmapDescriptor objBitmapDescriptor = BitmapDescriptorFactory.FromBitmap (objBitmap);
GroundOverlayOptions objGroundOverlayOptions = new GroundOverlayOptions ().PositionFromBounds (bounds)/*.Position (objMapPosition, 100000)*/.InvokeImage (objBitmapDescriptor);
map.AddGroundOverlay (objGroundOverlayOptions);
//For freeing memory
objBitmap.Recycle ();
}
for (int i = 0; i < extendedMap.pinDatas.Count; i++) {
var markerWithIcon = new MarkerOptions ();
markerWithIcon.SetPosition (new LatLng (extendedMap.pinDatas[i].lat, extendedMap.pinDatas[i].lng));
markerWithIcon.SetTitle (i.ToString());
/*markerWithIcon.SetTitle ("aa");
markerWithIcon.SetSnippet ("bb");*/
int resID = Resources.GetIdentifier (extendedMap.pinDatas [i].icon, "drawable" , "com.app1001.bluemart");
//System.Diagnostics.Debug.WriteLine (resID);
markerWithIcon.SetIcon(BitmapDescriptorFactory.FromResource(resID));
map.AddMarker (markerWithIcon);
}
//Add Pins
//map.SetInfoWindowAdapter(this);
map.UiSettings.RotateGesturesEnabled = false;
}
示例6: OnElementPropertyChanged
protected override void OnElementPropertyChanged (object sender, PropertyChangedEventArgs e)
{
base.OnElementPropertyChanged (sender, e);
if (e.PropertyName.Equals ("VisibleRegion") && !isDrawn) {
map.Clear ();
foreach (var pin in customPins) {
var marker = new MarkerOptions ();
marker.SetPosition (new LatLng (pin.Pin.Position.Latitude, pin.Pin.Position.Longitude));
marker.SetTitle (pin.Pin.Label);
marker.SetSnippet (pin.Pin.Address);
marker.SetIcon (BitmapDescriptorFactory.FromResource (Resource.Drawable.pin));
map.AddMarker (marker);
}
isDrawn = true;
}
}
示例7: CreateMarker
void CreateMarker()
{
var markerWithIcon = new MarkerOptions();
var id = UIFileUtils.GetResourceIdFromFilename("pin.png");
markerWithIcon.SetPosition(new LatLng(formsMap.MapPinLocation.Latitude, formsMap.MapPinLocation.Longitude));
markerWithIcon.SetTitle("A blue pin");
markerWithIcon.SetSnippet(string.Empty);
markerWithIcon.SetIcon(BitmapDescriptorFactory.FromResource(id));
map.MyLocationEnabled = formsMap.IsShowingUser;
map.SetIndoorEnabled(false);
try
{
map.AddMarker(markerWithIcon);
}
catch (NullPointerException ex)
{
System.Console.WriteLine("Exception : {0}--{1}", ex.Message, ex.InnerException);
}
isDrawnDone = true;
}
示例8: AddMarker
private void AddMarker(MapPin pin)
{
using (var op = new MarkerOptions())
{
op.SetTitle(pin.Label);
op.SetPosition(pin.Position.ToLatLng());
op.SetIcon(BitmapDescriptorFactory.DefaultMarker(pin.Color.ToAndroidMarkerHue()));
var marker = NativeMap.AddMarker(op);
pin.Id = marker.Id;
Markers.Add(pin, marker);
}
}
示例9: UpdateImage
/// <summary>
/// Updates the image of a pin
/// </summary>
/// <param name="pin">The forms pin</param>
/// <param name="markerOptions">The native marker options</param>
private async Task UpdateImage(TKCustomMapPin pin, MarkerOptions markerOptions)
{
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(pin.DefaultPinColor.ToAndroid().GetHue());
}
else
{
bitmap = BitmapDescriptorFactory.DefaultMarker();
}
}
}
catch (Exception)
{
bitmap = BitmapDescriptorFactory.DefaultMarker();
}
markerOptions.SetIcon(bitmap);
}
示例10: ReadyForLocationMap
private void ReadyForLocationMap()
{
ready = true;
ZoomToCurrentLocation ();
startingLocation = new LatLng (lastKnownLocation.Latitude, lastKnownLocation.Longitude);
// current position marker
var currentPosMkrOpts = new MarkerOptions();
currentPosMkrOpts.SetPosition (new LatLng (lastKnownLocation.Latitude, lastKnownLocation.Longitude));
currentPosMkrOpts.SetTitle ("Current Position");
currentPosMkrOpts.SetIcon (BitmapDescriptorFactory.DefaultMarker (BitmapDescriptorFactory.HueCyan));
map.AddMarker (currentPosMkrOpts);
// next goal marker
GenerateNewGoalLocation();
}
示例11: OnLocationChanged
public void OnLocationChanged (Android.Locations.Location location)
{
string tag= "OnLocationChanged";
Log.Debug (tag, "Location changed");
if (imhere.Enabled == false) {
imhere.Enabled = true;
imhere.Text="Estoy Aquí";
}
esperadatos.Visibility = ViewStates.Gone;
if (FragmentMap.Visibility == ViewStates.Gone) {
FragmentMap.Visibility = ViewStates.Visible;
}
lat = location.Latitude.ToString ();
lng = location.Longitude.ToString ();
LatLng location2 = new LatLng(Convert.ToDouble(lat), Convert.ToDouble(lng));
CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
builder.Target(location2);
builder.Zoom(16);
//builder.Bearing(155);
//builder.Tilt(65);
CameraPosition cameraPosition = builder.Build();
CameraUpdate cameraUpdate = CameraUpdateFactory.NewCameraPosition(cameraPosition);
if (map != null)
{
map.MapType = GoogleMap.MapTypeNormal;
MarkerOptions markerOpt1 = new MarkerOptions();
markerOpt1.SetPosition(new LatLng(Convert.ToDouble(lat), Convert.ToDouble(lng)));
markerOpt1.SetTitle("Aquí estoy!");
markerOpt1.SetIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.pliflocation3));
markerOpt1.Draggable(true);
if (currentm != null) {
currentm.Remove ();
}
currentm = null;
currentm=map.AddMarker(markerOpt1);
map.MoveCamera(cameraUpdate);
}
Log.Debug (tag, "LATITUD: "+lat+" LONGITUD: "+lng);
}
示例12: OnCreate
//.........这里部分代码省略.........
if(objeto["subcategoria"]=="" || objeto["subcategoria"]==null || objeto["subcategoria"]=="null"){
subcategoria.Text="";
guioncat.Text="";
}else{
subcategoria.Text=objeto["subcategoria"];
}
//likes
likes.Text=objeto["likes"]+" Personas";
//mapa?
try{
mapFrag = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map);
map = mapFrag.Map;
LatLng location = new LatLng(objeto["geo_lat"], objeto["geo_long"]);
CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
builder.Target(location);
builder.Zoom(16);
//builder.Bearing(155);
//builder.Tilt(65);
CameraPosition cameraPosition = builder.Build();
CameraUpdate cameraUpdate = CameraUpdateFactory.NewCameraPosition(cameraPosition);
if (map != null)
{
map.MapType = GoogleMap.MapTypeNormal;
MarkerOptions markerOpt1 = new MarkerOptions();
markerOpt1.SetPosition(new LatLng(objeto["geo_lat"], objeto["geo_long"]));
markerOpt1.SetTitle(objeto["titulo"]);
markerOpt1.SetIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.pliflocation3));
markerOpt1.Draggable(true);
map.AddMarker(markerOpt1);
map.MoveCamera(cameraUpdate);
}
}catch(Exception ex){
Log.Debug (tag, "GMAPS ERROR:"+ex);
}
//direccion
TextView callenum = FindViewById<TextView> (Resource.Id.callenum);
callenum.Text=objeto["geo_calle"]+" "+objeto["geo_numero"];
TextView colonia = FindViewById<TextView> (Resource.Id.colonia);
colonia.Text=objeto["geo_colonia"];
TextView regpais = FindViewById<TextView> (Resource.Id.regpais);
regpais.Text=objeto["geo_estado"]+", "+objeto["geo_pais"];
//acerca de este negocio
TextView mapmarker1 = FindViewById<TextView> (Resource.Id.sobreeste);
mapmarker1.SetTypeface(font, TypefaceStyle.Normal);
TextView descripcion = FindViewById<TextView> (Resource.Id.descripcion);
string desc=objeto["descripcion"];
descripcion.Text=System.Net.WebUtility.HtmlDecode(desc);
descripcion.Visibility=ViewStates.Gone;
WebView descweb = FindViewById<WebView> (Resource.Id.descweb);
示例13: OnBeforeClusterItemRendered
protected async override void OnBeforeClusterItemRendered(Java.Lang.Object context, MarkerOptions markerOptions)
{
var station = (context as ClusterItem).Station;
if (station.Contract.StationRefreshGranularity)
{
if (!station.IsInRefreshPool)
{
_contractService.AddStationToRefreshingPool(station);
}
}
markerOptions.SetIcon(CreateStationIcon(station));
// BitmapDescriptor markerDescriptor = BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueMagenta);
//var tmp = BitmapFactory.DecodeResource(_context.Resources, Resource.Drawable.stationGris);
//IconGenerator iconGen = null;
//// Define the size you want from dimensions file
//var shapeDrawable = ResourcesCompat.GetDrawable(_context.Resources, Resource.Drawable.station, null);
//iconGen.SetBackground(shapeDrawable);
////// Create a view container to set the size
//View view = (_context as MainActivity).LayoutInflater.Inflate(Resource.Layout.MarkerText, null);
//var text = view.FindViewById<TextView>(Resource.Id.text);
}
示例14: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
var rootView = inflater.Inflate(Resource.Layout.fragment, null);
var containerMap = (FrameLayout) rootView.FindViewById(Resource.Id.container_map);
var mapView = base.OnCreateView(inflater, container, savedInstanceState);
containerMap.AddView(mapView,
new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent));
var map = Map;
map.MoveCamera(CameraUpdateFactory.NewLatLngZoom(new LatLng(48.35, 31.16), 5.5f));
map.UiSettings.RotateGesturesEnabled = false;
map.SetOnMapClickListener(this);
map.SetOnMarkerClickListener(this);
map.Clear();
_spots.Clear();
var icon = BitmapDescriptorFactory.FromResource(Resource.Drawable.pin);
foreach (var spot in SpotsArray)
{
var mo = new MarkerOptions();
mo.SetPosition(spot.Position);
mo.SetIcon(icon);
mo.SetTitle(spot.Name);
mo.SetSnippet("foo");
var marker = map.AddMarker(mo);
_spots.Add(marker.Id, new AnnotationModel(marker, spot));
}
_infoWindowContainer = rootView.FindViewById(Resource.Id.container_popup);
// Subscribe to resize pop-up window
_infoWindowLayoutListener = new InfoWindowLayoutListener();
_infoWindowContainer.ViewTreeObserver.AddOnGlobalLayoutListener(_infoWindowLayoutListener);
OverlayLayoutParams = (AbsoluteLayout.LayoutParams) _infoWindowContainer.LayoutParameters;
textView = (TextView) _infoWindowContainer.FindViewById(Resource.Id.textview_title);
_button = (Button) _infoWindowContainer.FindViewById(Resource.Id.foo);
_button.SetOnClickListener(this);
return rootView;
}
示例15: AddEndMarker
void AddEndMarker(LatLng end)
{
Activity?.RunOnUiThread(() =>
{
var logicalDensity = Resources.DisplayMetrics.Density;
var thicknessPoints = (int) Math.Ceiling(20*logicalDensity + .5f);
var b = ContextCompat.GetDrawable(Activity, Resource.Drawable.ic_end_point) as BitmapDrawable;
var finalIcon = Bitmap.CreateScaledBitmap(b.Bitmap, thicknessPoints, thicknessPoints, false);
var endMarker = new MarkerOptions();
endMarker.SetPosition(end);
endMarker.SetIcon(BitmapDescriptorFactory.FromBitmap(finalIcon));
endMarker.Anchor(.5f, .5f);
map.AddMarker(endMarker);
});
}