0
我有一個非常奇怪的問題,地圖引腳不顯示在地圖上。Xamarin地圖引腳隱形
我使用Xamarin.Forms.Maps
我設立一個地圖
map = new CustomMap(
MapSpan.FromCenterAndRadius(
new Position(37, -122), Distance.FromMiles(0.3)), this)
{
IsShowingUser = true,
HeightRequest = 100,
WidthRequest = 960,
VerticalOptions = LayoutOptions.FillAndExpand
};
然後,我創建一個絕對的佈局,並添加地圖,並設置absoluteLayout是內容
var absoluteLayout = new AbsoluteLayout
{
BackgroundColor = Color.Red.WithLuminosity(0.9),
VerticalOptions = LayoutOptions.FillAndExpand
};
AbsoluteLayout.SetLayoutBounds(map, new Rectangle(0, 0, 1, 1));
AbsoluteLayout.SetLayoutFlags(map, AbsoluteLayoutFlags.All);
absoluteLayout.Children.Add(map);
absoluteLayout.Children.Add(btn);
Content = absoluteLayout;
我還初始銷添加到地圖
PinInfo firstInfo = new PinInfo
{
pinId = "1",
Description = "First Description",
};
var pin = new Pin
{
Type = PinType.Place,
Position = position,
Label = "custom pin",
Address = "custom detail info",
BindingContext = firstInfo,
};
pin.Clicked += async (sender, e) =>
{
await DisplayAlert(pin.Label, "The address is: " + pin.Address, "Cancel");
};
map.Pins.Add(pin);
但是,在應用程序中,我可以看到地圖,但它沒有放大到初始區域,添加的針腳什麼都不做,我看不到最初的針腳。
我一直在試圖爲一個很長的時間,現在在網上搜索,但由於某種原因還沒有發現有類似問題的人......
任何幫助是非常讚賞。