本文整理汇总了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));
}
}
}
}
示例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);
}