0

我正在关注https://mapsui.com/documentation/getting-started-xamarin-forms.html上的快速入门,想知道我是否需要自己获取位置(例如 Xamarin.Essentials 的位置例程)或 Mapsui 将自己获得一个。我在 AndroidManifest 中标记了位置权限,允许访问,但蓝色圆圈仍然指向 0,0 坐标。

编辑:这是代码

    public MainPage()
    {
        InitializeComponent();

        map = new Mapsui.Map
        {
            CRS = "EPSG:3857",
            Transformation = new MinimalTransformation(),
        };

        var tileLayer = OpenStreetMap.CreateTileLayer();

        map.Layers.Add(tileLayer);
        map.Widgets.Add(new Mapsui.Widgets.ScaleBar.ScaleBarWidget(map) { 
            TextAlignment = Mapsui.Widgets.Alignment.Center, 
            HorizontalAlignment = Mapsui.Widgets.HorizontalAlignment.Left, 
            VerticalAlignment = Mapsui.Widgets.VerticalAlignment.Bottom });

        mapView.MyLocationEnabled = true;
        mapView.PanLock = true;
        mapView.Map = map;
    }

不幸的是,对地图没有MyLocationEnabled任何PanLock影响 - 蓝色圆圈仍处于 0,0 且地图未锁定。

4

0 回答 0