【问题标题】:Why are Xamarin Forms.maps Pin not showing information on click in Android?为什么 Xamarin Forms.maps Pin 在 Android 中不显示点击信息?
【发布时间】:2021-02-17 15:33:24
【问题描述】:

我将 PinsCollection Observablecollection 作为我的 forms.map 的 itemSource。它会加载 iOS 中的所有引脚,点击每个引脚我可以看到标签和地址。但在 Android 中,我可以看到所有图钉,但点击图钉时没有任何反应。

【问题讨论】:

    标签: xamarin xamarin.forms xamarin.android maps


    【解决方案1】:

    如果您想在单击图钉时执行某些操作,可以使用MarkerClicked 。当点击 pin 时会触发 MarkerClicked 事件。

    boardwalkPin.MarkerClicked += async (s, args) =>
    {
    args.HideInfoWindow = true;
    string pinName = ((Pin)s).Label;
    await DisplayAlert("Pin Clicked", $"{pinName} was clicked.", "Ok");
    };
    

    您可以从下面的链接下载源代码。 https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/map/pins

    【讨论】:

      猜你喜欢
      • 2020-10-11
      • 2014-01-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-28
      • 2016-02-18
      • 1970-01-01
      相关资源
      最近更新 更多