当前位置: 首页>>代码示例>>C#>>正文


C# GoogleMap.SetOnMapLoadedCallback方法代码示例

本文整理汇总了C#中Android.Gms.Maps.GoogleMap.SetOnMapLoadedCallback方法的典型用法代码示例。如果您正苦于以下问题:C# GoogleMap.SetOnMapLoadedCallback方法的具体用法?C# GoogleMap.SetOnMapLoadedCallback怎么用?C# GoogleMap.SetOnMapLoadedCallback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Android.Gms.Maps.GoogleMap的用法示例。


在下文中一共展示了GoogleMap.SetOnMapLoadedCallback方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FindMap

		void FindMap ()
		{
			_map = (SupportFragmentManager.FindFragmentById (Resource.Id.map) as SupportMapFragment).Map;
			if (_map != null) {
				_map.MyLocationEnabled = true;

				_map.UiSettings.TiltGesturesEnabled = false;
				_map.UiSettings.RotateGesturesEnabled = false;

				_map.MapClick += OnMapClick;
				_map.MapLongClick += OnMapLongClick;
				_map.MyLocationChange += HandleMyLocationChange;
				_map.MarkerClick += OnMarkerClick;

				_map.SetInfoWindowAdapter (new InfoWindowAdapter ());

				// here because map should be already initialized
				// http://developer.android.com/reference/com/google/android/gms/maps/model/BitmapDescriptorFactory.html
				_alarm_marker_normal = BitmapDescriptorFactory.FromResource (Resource.Drawable.marker_violet);
				_alarm_marker_normal_selected = BitmapDescriptorFactory.FromResource (Resource.Drawable.marker_violet_selected);
				_alarm_marker_disabled_selected = BitmapDescriptorFactory.FromResource (Resource.Drawable.marker_grey_selected);				
				_alarm_marker_disabled = BitmapDescriptorFactory.FromResource (Resource.Drawable.marker_grey);
                
				RefreshData ();

				_map.SetOnMapLoadedCallback (this);

				if (Mode == Mode.Add) {
					if (AlarmToAddMarker != null) {
						AlarmToAddMarker = _map.AddMarker (new MarkerOptions ().SetPosition (AlarmToAddMarker.Position).InvokeIcon (_alarm_marker_normal));
					}
				}
			}
		}
开发者ID:foxanna,项目名称:SimpleLocationAlarm,代码行数:34,代码来源:HomeActivityMapWork.cs

示例2: OnAttached

		protected override void OnAttached()
		{
			var mapView = Control as MapView;
			if(mapView == null)
				return;

			behavior = (MapExtensionBehavior) (Element as Map)?.Behaviors?.FirstOrDefault(x =>
				x is MapExtensionBehavior);
			if(behavior == null)
				return;
			

			var zoomButton = mapView.FindViewById(1); // ズームボタン LinearLayout
			if(zoomButton != null)
			{
				zoomButton.Visibility = Android.Views.ViewStates.Invisible;
			}

			var locationButton = mapView.FindViewById(2); // 現在位置ボタン ImageView
			if(locationButton != null)
			{
				locationButton.Visibility = Android.Views.ViewStates.Invisible;
			}

			var callback = new OnMapReadyCallback();
			callback.MapReady += (sender, e) => {
				googleMap = callback.GoogleMap;

				googleMap.MyLocationChange += GoogleMap_MyLocationChange;
				// なぜかCameraChangeにハンドラを追加するとXF.Maps.Map.VisibleRegionが更新されなくなる
//				googleMap.CameraChange += GoogleMap_CameraChange;

				var point = new LatLng(
					XFAedSearch.Droid.Helpers.Settings.Latitude,
					XFAedSearch.Droid.Helpers.Settings.Longitude);
				googleMap.MoveCamera(CameraUpdateFactory.NewLatLngZoom(point,
					XFAedSearch.Droid.Helpers.Settings.ZoomLevel));

				googleMap.SetOnMapLoadedCallback(new MapLoadedCallback {
					OnMapLoadedAction = () => MapLoaded?.Invoke(this, new EventArgs())
				});
			};
			mapView.GetMapAsync(callback);

		}
开发者ID:P3PPP,项目名称:XFAedSearch,代码行数:45,代码来源:MapEffect.cs


注:本文中的Android.Gms.Maps.GoogleMap.SetOnMapLoadedCallback方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。