本文整理汇总了C#中Android.Gms.Maps.Model.MarkerOptions.Draggable方法的典型用法代码示例。如果您正苦于以下问题:C# MarkerOptions.Draggable方法的具体用法?C# MarkerOptions.Draggable怎么用?C# MarkerOptions.Draggable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Gms.Maps.Model.MarkerOptions
的用法示例。
在下文中一共展示了MarkerOptions.Draggable方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.SecondView);
var viewModel = (SecondViewModel) ViewModel;
var mapFragment = (SupportMapFragment)SupportFragmentManager.FindFragmentById(Resource.Id.map);
var options = new MarkerOptions();
options.SetPosition(new LatLng(viewModel.Han.Location.Lat, viewModel.Han.Location.Lng));
options.SetTitle("Han");
options.Draggable(true);
var hanMarker = mapFragment.Map.AddMarker(options);
_han = new MarkerWrapper(hanMarker);
mapFragment.Map.MarkerDragEnd += (sender, args) =>
{
_han.FirePositionChangedFromMap();
};
var set = this.CreateBindingSet<SecondView, SecondViewModel>();
set.Bind(_han)
.For(m => m.Position)
.To(vm => vm.Han.Location)
.WithConversion(new LocationToLatLngValueConverter(), null);
set.Apply();
}
示例2: MapRoute
public MapRoute(GoogleMap map, List<Station> stations)
{
_map = map;
_mapRoutes = new List<Polyline>();
_mapStations = new List<Marker>();
// Choose color;
Color color = Color.DodgerBlue;
// Create polyline.
var polyline = new PolylineOptions();
polyline.InvokeWidth(4f);
polyline.InvokeColor(color);
for (var i = 0; i < stations.Count; i++)
{
// Add points to polyline.
var station = stations[i];
if (station != null && station.latitude != 0f && station.longitude != 0f)
{
var latlng = new Android.Gms.Maps.Model.LatLng(station.latitude, station.longitude);
polyline.Add(latlng);
// Create marker.
var marker = new MarkerOptions();
marker.SetPosition(latlng);
marker.SetTitle((i + 1) + ". " + station.postName);
marker.Draggable(false);
marker.SetSnippet("ul. " + station.street);
_mapStations.Add(_map.AddMarker(marker));
}
}
// Add polyline to map.
_mapRoutes.Add(_map.AddPolyline(polyline));
}
示例3: OnMyLocationButtonClick
private void OnMyLocationButtonClick(object sender, GoogleMap.MyLocationButtonClickEventArgs e)
{
var myLocation = GetMyLocation();
if (myLocation == null)
{
Logger.Log("Brak sygna³u GPS.");
MessagingCenter.Send(_myMap, "DisplayAlert", new AlertMessage("B³¹d", "Brak sygna³u GPS."));
return;
}
var myLatLng = new Android.Gms.Maps.Model.LatLng(myLocation.Latitude, myLocation.Longitude);
// Create new starting marker.
if (_startMarker == null)
{
var marker = new MarkerOptions();
marker.SetPosition(myLatLng);
marker.SetTitle("Od");
marker.Draggable(true);
// TODO: Custom start icon.
_startMarker = _map.AddMarker(marker);
_startMarker.ShowInfoWindow();
}
// Move existing marker.
else
{
_startMarker.Position = myLatLng;
_startMarker.ShowInfoWindow();
}
_map.AnimateCamera(CameraUpdateFactory.NewLatLngZoom(myLatLng, DefaultZoom));
}
示例4: OnMapClick
private void OnMapClick(object sender, GoogleMap.MapClickEventArgs e)
{
var latlng = e.Point;
// Create new destination marker.
if (_destinationMarker == null)
{
var marker = new MarkerOptions();
marker.SetPosition(latlng);
marker.SetTitle("Do");
marker.Draggable(true);
marker.SetSnippet("Punkt docelowy");
// TODO: Custom destination icon.
_destinationMarker = _map.AddMarker(marker);
_destinationMarker.ShowInfoWindow();
}
// Move existing marker.
else
{
_destinationMarker.Position = latlng;
_destinationMarker.ShowInfoWindow();
}
}
示例5: OnBtnLocalizeClicked
private void OnBtnLocalizeClicked(MapPage mapPage)
{
var myLocation = GetMyLocation();
if (myLocation == null)
{
Logger.Log("Brak sygna³u GPS.");
MessagingCenter.Send(_myMap, "DisplayAlert", new AlertMessage("B³¹d", "Brak sygna³u GPS."));
return;
}
var myLatLng = new Android.Gms.Maps.Model.LatLng(myLocation.Latitude, myLocation.Longitude);
// Create new starting marker.
if (_startMarker == null)
{
var marker = new MarkerOptions();
marker.SetPosition(myLatLng);
marker.SetTitle("Od");
marker.Draggable(false);
// TODO: Custom start icon.
_startMarker = _map.AddMarker(marker);
_startMarker.ShowInfoWindow();
}
// Move existing marker.
else
{
_startMarker.Position = myLatLng;
}
_map.AnimateCamera(CameraUpdateFactory.NewLatLngZoom(myLatLng, DefaultZoom));
// TODO: Display nearest stations.
var nearestStations = App.Database.GetNearestStations(myLatLng.Latitude, myLatLng.Longitude, 5);
for (var i = 0; i < nearestStations.Length; i++)
{
var station = nearestStations[i];
var marker = new MarkerOptions();
var latLng = new Android.Gms.Maps.Model.LatLng(station.latitude, station.longitude);
marker.SetPosition(latLng);
marker.SetTitle(string.Format("{0}. {1} - {2}", station.postId, station.postName, station.street));
marker.Draggable(false);
marker.SetSnippet("Wiêcej...");
// TODO: Custom stations's icon.
var mapMarker = _map.AddMarker(marker);
var stationMarker = new StationMarker(station, mapMarker);
_nearestMarkers.Add(stationMarker);
}
}
示例6: updatePins
private void updatePins()
{
var androidMapView = (MapView)Control;
var formsMap = (Xam.Plugin.MapExtend.Abstractions.MapExtend)Element;
androidMapView.Map.Clear();
androidMapView.Map.MyLocationEnabled = formsMap.IsShowingUser;
var items = formsMap.Pins;
foreach (var item in items)
{
var markerWithIcon = new MarkerOptions();
markerWithIcon.SetPosition(new LatLng(item.Position.Latitude, item.Position.Longitude));
markerWithIcon.SetTitle(string.IsNullOrWhiteSpace(item.Label) ? "-" : item.Label);
markerWithIcon.Draggable(true);
androidMapView.Map.AddMarker(markerWithIcon);
}
}
示例7: AddPin
/// <summary>
/// Adds a marker to the map
/// </summary>
/// <param name="pin">The Forms Pin</param>
private async void AddPin(TKCustomMapPin pin)
{
var markerWithIcon = new MarkerOptions();
markerWithIcon.SetPosition(new LatLng(pin.Position.Latitude, pin.Position.Longitude));
if (!string.IsNullOrWhiteSpace(pin.Title))
markerWithIcon.SetTitle(pin.Title);
if (!string.IsNullOrWhiteSpace(pin.Subtitle))
markerWithIcon.SetSnippet(pin.Subtitle);
await this.UpdateImage(pin, markerWithIcon);
markerWithIcon.Draggable(pin.IsDraggable);
markerWithIcon.Visible(pin.IsVisible);
this._markers.Add(pin, this._googleMap.AddMarker(markerWithIcon));
}
示例8: 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);
}
示例9: OnCreate
//.........这里部分代码省略.........
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);
descweb.Settings.JavaScriptEnabled=true;