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


C# GoogleMap.SetOnMarkerClickListener方法代码示例

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


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

示例1: OnMapReady

        public void OnMapReady(GoogleMap googleMap)
        {
            map = googleMap;
            map.MyLocationEnabled = true;
            map.MapType = GoogleMap.MapTypeNormal;
            map.UiSettings.ZoomControlsEnabled = true;

            //map.UiSettings.CompassEnabled = true;
            map.UiSettings.SetAllGesturesEnabled(true);
            //map.UiSettings.RotateGesturesEnabled = true;
            map.AddMarker(new MarkerOptions().SetPosition(Location_NewYork));
            map.SetOnMarkerClickListener (this);

            /*LocationManager locManager = GetSystemService (Context.LocationService) as LocationManager;
            if (locManager.IsProviderEnabled (LocationManager.GpsProvider)) {
                locManager.RequestLocationUpdates (1000, 10, criteria, this, null);
            }

            else
            {
                AlertDialog.Builder builder = new AlertDialog.Builder(this);
                builder.SetTitle("GPS Disabled");
                builder.SetMessage("Enable GPS to use the app");
                builder.SetCancelable(false);
                builder.SetPositiveButton("OK", delegate { StartActivityForResult (new Intent(Android.Provider.Settings.ActionLocationSourceSettings), 0);
                });
                builder.Show();
            }*/
            FindViewById<Button> (Resource.Id.sharebutton).Click += delegate {
                {
                    var geoUri = Android.Net.Uri.Parse ("geo:"+ _currentLocation.Latitude+","+_currentLocation.Longitude);
                    var mapIntent = new Intent (Intent.ActionView, geoUri);
                    //mapIntent.SetType(
                    //StartActivity (mapIntent);

                    var smsUri = Android.Net.Uri.Parse("smsto:1234567890");
                    var smsIntent = new Intent (Intent.ActionSendto, smsUri);
                    StringBuilder smsstring = new StringBuilder();
                    smsstring.Append("Click the link to track ");
                    smsstring.Append("http://maps.google.com?q=");
                    smsstring.Append(_currentLocation.Latitude);
                    smsstring.Append(",");
                    smsstring.Append(_currentLocation.Longitude);
                    smsIntent.PutExtra ("sms_body",smsstring.ToString() );
                    StartActivity (smsIntent);
                }
            };
        }
开发者ID:Dev-Idres,项目名称:MyFriends,代码行数:48,代码来源:MainActivity.cs

示例2: OnMapReady

                public void OnMapReady( GoogleMap map )
                {
                    // sanity checks in case loading the map fails (Google Play can error)
                    if ( map != null )
                    {
                        Map = map;

                        // because google can actually give me a valid map that isn't actually ready.
                        try
                        {
                            // For privacy, turn off the map toolbar, which prevents people from getting specific driving directions
                            // to neighborhood group houses.
                            Map.UiSettings.MapToolbarEnabled = false;
                            Map.SetOnMarkerClickListener( this );

                            // set the map to a default position
                            // additionally, set the default position for the map to whatever specified area.
                            Android.Gms.Maps.Model.LatLng defaultPos = new Android.Gms.Maps.Model.LatLng( ConnectConfig.GroupFinder_DefaultLatitude, ConnectConfig.GroupFinder_DefaultLongitude );

                            CameraUpdate camPos = CameraUpdateFactory.NewLatLngZoom( defaultPos, ConnectConfig.GroupFinder_DefaultScale_Android );
                            map.MoveCamera( camPos );

                            // see if there's an address for this person that we can automatically use.
                            if ( RockMobileUser.Instance.HasFullAddress( ) == true )
                            {
                                // if they don't already have any value, use their address
                                if ( string.IsNullOrEmpty( StreetValue ) == true &&
                                     string.IsNullOrEmpty( CityValue ) == true &&
                                     string.IsNullOrEmpty( StateValue ) == true &&
                                     string.IsNullOrEmpty( ZipValue ) == true )
                                {
                                    SearchPage.SetAddress( RockMobileUser.Instance.Street1( ), RockMobileUser.Instance.City( ), RockMobileUser.Instance.State( ), RockMobileUser.Instance.Zip( ) );    
                                }
                                else
                                {
                                    // otherwise use what they last had.
                                    SearchPage.SetAddress( StreetValue, CityValue, StateValue, ZipValue );
                                }
                            }
                            else
                            {
                                // otherwise, if there are values from a previous session, use those.
                                SearchPage.SetAddress( StreetValue, CityValue, string.IsNullOrEmpty( StateValue ) ? ConnectStrings.GroupFinder_DefaultState : StateValue, ZipValue );
                            }
                        }
                        catch
                        {
                        }
                    }
                }
开发者ID:Higherbound,项目名称:HBMobileApp,代码行数:50,代码来源:GroupFinderFragment.cs

示例3: SetupMapIfNeeded

        private void SetupMapIfNeeded()
        {
            if (_map == null)
            {
                _map = _mapFragment.Map;
                if (_map != null)
                {
                    SetViewPoint (new LatLng(63.430515, 10.395053), false);

                    _clusterManager = new ClusterManager (this, _map);
                    _clusterManager.SetOnClusterClickListener (this);
                    _clusterManager.SetOnClusterItemClickListener (this);
                    _map.SetOnCameraChangeListener (_clusterManager);
                    _map.SetOnMarkerClickListener (_clusterManager);

                    AddClusterItems ();
                }
            }
        }
开发者ID:Zve,项目名称:MapsUtilityDemo,代码行数:19,代码来源:MainActivity.cs


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