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


C# MapView.SetBuiltInZoomControls方法代码示例

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


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

示例1: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            /*
             * For Information on how to add you own keystore to the project read the README from the
             * old GoogleMaps sample: https://github.com/xamarin/monodroid-samples/tree/master/GoogleMaps
             * 
             * */

            // Remember to generate your own API key
            mapView = new MapView(this, "0Nd7w_yOI1NbUsBP_Mg2IosWa0Ns2j22r4meJnA");
            mapView.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent);

            SetContentView(mapView);

            mapView.SetBuiltInZoomControls(true);
            mapView.Enabled = true;
            mapView.Clickable = true; //This has to be set to true to be able to navigate the map

            myLocationOverlay = new MyLocationOverlay(this, mapView); //this shows your current position on the map
            mapView.Overlays.Add(myLocationOverlay);

            Drawable marker = Resources.GetDrawable(Resource.Drawable.Icon); //these are the markers put on the map
            myItemizedOverlay = new MyItemizedOverlay(this, marker);
            mapView.Overlays.Add(myItemizedOverlay);

            myItemizedOverlay.AddItem(new GeoPoint((int)(55.816149 * 1E6),(int)(12.532868 * 1E6)), "BKSV", "Brüel & Kjær Sound & Vision");
            mapView.PostInvalidate();
        }
开发者ID:Cheesebaron,项目名称:MonoDroid.GoogleMapsDemo,代码行数:30,代码来源:MapActivity.cs

示例2: OnCreate

        protected override void OnCreate (Bundle bundle)
        {
            base.OnCreate (bundle);

            SetContentView (Resource.Layout.MapFragmentLayout);

            mapView = FindViewById<MapView> (Resource.Id.fragmentMapView);
            myLocation = new MyLocationOverlay (this, mapView);
            myLocation.RunOnFirstFix (() => {
                //mapView.Controller.AnimateTo (myLocation.MyLocation);

                var maxLat = Math.Max (myLocation.MyLocation.LatitudeE6, assignment.Latitude.ToIntE6 ());
                var minLat = Math.Min (myLocation.MyLocation.LatitudeE6, assignment.Latitude.ToIntE6 ());
                var maxLong = Math.Max (myLocation.MyLocation.LongitudeE6, assignment.Longitude.ToIntE6 ());
                var minLong = Math.Min (myLocation.MyLocation.LongitudeE6, assignment.Longitude.ToIntE6 ());

                mapView.Controller.ZoomToSpan (Math.Abs (maxLat - minLat), Math.Abs (maxLong - minLong));

                mapView.Controller.AnimateTo (new GeoPoint ((maxLat + minLat) / 2, (maxLong + minLong) / 2));
            });

            mapView.Overlays.Add (myLocation);
            mapView.Controller.SetZoom (5);
            mapView.Clickable = true;
            mapView.Enabled = true;
            mapView.SetBuiltInZoomControls (true);
        }
开发者ID:harouny,项目名称:prebuilt-apps,代码行数:27,代码来源:MapFragmentActivity.cs

示例3: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.MapView);

            map = FindViewById<MapView>(Resource.Id.Map);

            map.Clickable = true;
            map.Traffic = false;
            map.Satellite = true;

            map.SetBuiltInZoomControls(true);
            map.Controller.SetZoom(17);
            map.Controller.SetCenter(new GeoPoint((int)(29.97611 * 1e6), (int)(31.132778 * 1e6))); // Pyramids of Giza

            AddPinOverlay(map);
        }
开发者ID:robertgreen,项目名称:monodroid-samples,代码行数:18,代码来源:MapViewOverlayScreen.cs

示例4: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.MapView);

            map = FindViewById<MapView>(Resource.Id.Map);

            map.Clickable = true;
            map.Traffic = false;
            map.Satellite = true;

            map.SetBuiltInZoomControls(true);
            map.Controller.SetZoom(15);
            map.Controller.SetCenter(new GeoPoint((int)(48.857 * 1e6), (int)(2.351 * 1e6))); // Paris

            AddMyLocationOverlay(map);
        }
开发者ID:robertgreen,项目名称:monodroid-samples,代码行数:18,代码来源:MapViewCurrentLocationScreen.cs

示例5: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.MapView);

            map = FindViewById<MapView>(Resource.Id.Map);

            map.Clickable = true;
            map.Traffic = false;
            map.Satellite = true;

            map.SetBuiltInZoomControls(true);
            map.Controller.SetZoom(15);
            map.Controller.SetCenter(new GeoPoint((int)(34.120 * 1e6), (int)(-118.188 * 1e6))); // Los Angeles

            AddPinOverlay(map);
        }
开发者ID:robertgreen,项目名称:monodroid-samples,代码行数:18,代码来源:MapViewAnnotationScreen.cs

示例6: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Map);

            _map = FindViewById<MapView>(Resource.Id.Map);
            _map.SetBuiltInZoomControls(true);

            var newYorkCity = new GeoPoint((int) (40.716667 * 1e6), (int) (-74 * 1e6));
            _map.Controller.SetCenter(newYorkCity);
            _map.Controller.SetZoom(14);

            _mapOverlay = new MapOverlay(Resources.GetDrawable(Resource.Drawable.Icon), this);
            _map.Overlays.Add(_mapOverlay);

            _mapOverlay.Add(newYorkCity, "New York City");

            _locationManager = (LocationManager)GetSystemService(LocationService);
        }
开发者ID:jorik041,项目名称:MobileDevelopmentInCSharpBook,代码行数:20,代码来源:LocationActivity.cs

示例7: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.main);
            _mapView = FindViewById<MapView>(Resource.Id.mapview);
            _mapView.SetBuiltInZoomControls(true);

            // First overlay
            _drawable1 = Resources.GetDrawable(Resource.Drawable.marker);
            _itemizedOverlay = new SimpleItemizedOverlay(_drawable1, _mapView);
            var point = new GeoPoint((int)(51.5174723 * 1E6), (int)(-0.0899537 * 1E6));
            var overlayItem = new OverlayItem(point, "Tomorrow Never Dies (1997)", "(M gives Bond his mission in Daimler car)");
            _itemizedOverlay.AddOverlay(overlayItem);

            var point2 = new GeoPoint((int)(51.515259 * 1E6), (int)(-0.086623 * 1E6));
            var overlayItem2 = new OverlayItem(point2, "GoldenEye (1995)", "(Interiors Russian defence ministry council chambers in St Petersburg)");
            _itemizedOverlay.AddOverlay(overlayItem2);

            _mapView.Overlays.Add(_itemizedOverlay);

            // second overlay
            _drawable2 = Resources.GetDrawable(Resource.Drawable.marker2);
            _itemizedOverlay2 = new SimpleItemizedOverlay(_drawable2, _mapView);

            var point3 = new GeoPoint((int)(51.513329 * 1E6), (int)(-0.08896 * 1E6));
            var overlayItem3 = new OverlayItem(point3, "Sliding Doors (1998)", null);
            _itemizedOverlay2.AddOverlay(overlayItem3);

            var point4 = new GeoPoint((int)(51.51738 * 1E6), (int)(-0.08186 * 1E6));
            var overlayItem4 = new OverlayItem(point4, "Mission: Impossible (1996)", "(Ethan & Jim cafe meeting)");
            _itemizedOverlay2.AddOverlay(overlayItem4);

            _mapView.Overlays.Add(_itemizedOverlay2);

            if (bundle == null)
            {
                var mc = _mapView.Controller;
                mc.SetZoom(16);
                mc.AnimateTo(point2);
            }
        }
开发者ID:89sos98,项目名称:monodroid-samples,代码行数:41,代码来源:Activity1.cs

示例8: SetupMap

        private void SetupMap(MapView map, Point center, int zoomLevel)
        {
            map.Controller.SetZoom(zoomLevel);
            map.Controller.SetCenter(new GeoPoint(center.Y, center.X));
            map.SetBuiltInZoomControls(true);

            _annotationView = new AnnotationView(map);
        }
开发者ID:knji,项目名称:mvvmcross.plugins,代码行数:8,代码来源:MapquestMapViewController.cs

示例9: OnCreate

        protected override void OnCreate (Bundle bundle)
        {
            base.OnCreate (bundle);

            // Create your application here
            SetContentView (Resource.Layout.MapViewLayout);

            assignmentMapViewLayout = FindViewById<LinearLayout> (Resource.Id.mapViewAssignmentLayout);
            assignmentMapViewLayout.Click += (sender, e) => {
                var intent = new Intent (this, typeof (SummaryActivity));
                var tabActivity = (AssignmentTabActivity)Parent;
                tabActivity.MapData = null;
                assignmentViewModel.SelectedAssignment = assignmentViewModel.ActiveAssignment;
                menuViewModel.MenuIndex = Constants.Navigation.IndexOf ("Map");
                StartActivity (intent);
            };
            mapView = FindViewById<MapView> (Resource.Id.googleMapsView);

            myLocation = new MyLocationOverlay (this, mapView);

            mapView.Overlays.Add (myLocation);
            mapView.Clickable = true;
            mapView.Enabled = true;
            mapView.SetBuiltInZoomControls (true);


            //View containing the active assignment
            var view = new View (this);
            LayoutInflater inflator = (LayoutInflater)GetSystemService (Context.LayoutInflaterService);
            view = inflator.Inflate (Resource.Layout.AssignmentItemLayout, null);
            assignmentMapViewLayout.AddView (view);
            view.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent);
            view.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.active_assignment_selector));
            number = view.FindViewById<TextView> (Resource.Id.assignmentItemNumber);
            job = view.FindViewById<TextView> (Resource.Id.assignmentJob);
            name = view.FindViewById<TextView> (Resource.Id.assignmentName);
            phone = view.FindViewById<TextView> (Resource.Id.assignmentPhone);
            address = view.FindViewById<TextView> (Resource.Id.assignmentAddress);
            buttonLayout = view.FindViewById<LinearLayout> (Resource.Id.assignmentButtonLayout);
            timerLayout = view.FindViewById<LinearLayout> (Resource.Id.assignmentTimerLayout);
            activeSpinner = view.FindViewById<Spinner> (Resource.Id.assignmentStatus);
            spinnerImage = view.FindViewById<ImageView> (Resource.Id.assignmentStatusImage);
            timer = view.FindViewById<ToggleButton> (Resource.Id.assignmentTimer);
            timerText = view.FindViewById<TextView> (Resource.Id.assignmentTimerText);
            phoneButton = view.FindViewById<RelativeLayout> (Resource.Id.assignmentPhoneLayout);
            mapButton = view.FindViewById<RelativeLayout> (Resource.Id.assignmentAddressLayout);

            phoneButton.Click += (sender, e) => {
                Extensions.MakePhoneCall (this, phone.Text);
            };

            mapButton.Click += (sender, e) => {
                var intent = new Intent (this, typeof (SummaryActivity));
                var tabActivity =(AssignmentTabActivity)Parent;
                tabActivity.MapData = null;
                assignmentViewModel.SelectedAssignment = assignmentViewModel.ActiveAssignment;
                menuViewModel.MenuIndex = 0;
                StartActivity (intent);
            };

            assignmentViewModel.LoadTimerEntryAsync ().ContinueWith (_ => {
                RunOnUiThread (() => {
                    if (assignmentViewModel.Recording) {
                        timer.Checked = true;
                    } else {
                        timer.Checked = false;
                    }
                });
            });

            timer.CheckedChange += (sender, e) => {
                if (e.IsChecked != assignmentViewModel.Recording) {
                    if (assignmentViewModel.Recording) {
                        assignmentViewModel.PauseAsync ();
                    } else {
                        assignmentViewModel.RecordAsync ();
                    }
                }
            };

            activeSpinner.ItemSelected += (sender, e) => {
                if (assignment != null) {
                    var selected = assignmentViewModel.AvailableStatuses.ElementAtOrDefault (e.Position);
                    if (selected != assignment.Status) {
                        switch (selected) {
                            case AssignmentStatus.Hold:
                                assignment.Status = selected;
                                assignmentViewModel.SaveAssignmentAsync (assignment).ContinueWith (_ => {
                                    RunOnUiThread (() => {
                                        SetAssignment (false);
                                        mapView.Overlays.Clear ();
                                        mapView.Overlays.Add (myLocation);
                                        UpdateLocations ();
                                    });
                                });
                                break;
                            case AssignmentStatus.Complete:
                                //go to confirmations
                                var intent = new Intent (this, typeof (SummaryActivity));
                                menuViewModel.MenuIndex = Constants.Navigation.IndexOf (Constants.Confirmations);
//.........这里部分代码省略.........
开发者ID:EminosoftCorp,项目名称:prebuilt-apps,代码行数:101,代码来源:MapViewActivity.cs

示例10: InitializeMapView

        private void InitializeMapView()
        {
            var apiKey = this.GetGoogleMapsApiKey();
            _map = new MapView(Activity, apiKey)
                       {
                           Clickable = true
                       };

            _map.Controller.SetZoom(17);
            _map.SetBuiltInZoomControls(true);
            _map.DisplayZoomControls(true);
        }
开发者ID:topgenorth,项目名称:yegbuildings,代码行数:12,代码来源:MapFragment.cs


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