private void SetLocation() { aMap.SetLocationSource(this); // 设置定位监听 aMap.UiSettings.MyLocationButtonEnabled = true; // 设置默认定位按钮是否 aMap.MyLocationEnabled = true; // 设置为true表示显示定位层并可触发定位,false表示隐藏定位层并不可触发定位,默认是false //aMap.SetMyLocationType(AMap.LOCATION_TYPE_LOCATE);//设置定位的类型为跟随模式,3D地图才有; // 自定义系统定位小蓝点 MyLocationStyle myLocationStyle = new MyLocationStyle(); myLocationStyle.InvokeMyLocationIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.Icon)); // 设置小蓝点的图标 myLocationStyle.InvokeStrokeColor(Android.Graphics.Color.Red); // 设置圆形的边框颜色 myLocationStyle.InvokeRadiusFillColor(Android.Graphics.Color.Argb(100, 0, 0, 180)); // 设置圆形的填充颜色 myLocationStyle.InvokeStrokeWidth(1.0f); // 设置圆形的边框粗细 aMap.SetMyLocationStyle(myLocationStyle); aMap.MapType = AMap.MapTypeNormal; }
private void setUpMap() { LatLng SHANGHAI = new LatLng(31.238068, 121.501654); aMap.MoveCamera(CameraUpdateFactory.NewLatLngZoom(SHANGHAI, 14)); aMap.MapType = AMap.MapTypeNormal; var pins = myAMapPage.Pins; Drawable d = Resources.GetDrawable(Resource.Drawable.red_location); Bitmap bitmap = ((BitmapDrawable)d).Bitmap; LatLng latLng1; foreach (UserTaskEntInfo pin in pins) { latLng1 = new LatLng(pin.Longitude ?? 31.238068, pin.Latitude ?? 121.501654); var markOption = new MarkerOptions(); markOption.InvokeIcon(BitmapDescriptorFactory.FromBitmap(bitmap)); markOption.InvokeTitle(pin.Name); markOption.InvokePosition(latLng1); var fix = aMap.AddMarker(markOption); fix.ShowInfoWindow(); } aMap.SetLocationSource(this); // 设置定位监听 aMap.UiSettings.MyLocationButtonEnabled = true; // 设置默认定位按钮是否显示 aMap.MyLocationEnabled = true; // 设置为true表示显示定位层并可触发定位,false表示隐藏定位层并不可触发定位,默认是false //aMap.SetMyLocationType(AMap.LOCATION_TYPE_LOCATE);//设置定位的类型为跟随模式,3D地图才有; // 自定义系统定位小蓝点 MyLocationStyle myLocationStyle = new MyLocationStyle(); myLocationStyle.InvokeMyLocationIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.location_marker)); // 设置小蓝点的图标 myLocationStyle.InvokeStrokeColor(Android.Graphics.Color.Black); // 设置圆形的边框颜色 myLocationStyle.InvokeRadiusFillColor(Android.Graphics.Color.Argb(100, 0, 0, 180)); // 设置圆形的填充颜色 myLocationStyle.InvokeStrokeWidth(1.0f); // 设置圆形的边框粗细 aMap.SetMyLocationStyle(myLocationStyle); }