【问题标题】:Does Xamarin Forms Google Maps (Custom Renderer based on <Maps>) Not have a POI onclick method?Xamarin Forms Google Maps (Custom Renderer based on <Maps>) 没有 POI onclick 方法吗?
【发布时间】:2019-07-13 18:19:51
【问题描述】:

我正在使用 Xamarin.Forms 构建 Android 和 IOS 应用程序。

我也在使用基于 xamarin.maps 构建的 Xamarin.maps.googlemaps 库 - github

这个库(以及xamarin.maps)只有一个OnMapClicked 事件处理程序。这个库恰好只返回点击位置的纬度和经度(见下文) 然后我只取那个纬度和经度并查询最近的 POI。

我记得当我从 Android Studio 专门为 Android 构建 google-maps 时,当我点击 google-map 并点击其中一个与地图一起显示的 POI 时,我得到了一些关于所点击 POI 的信息。

xamarin.maps.googlemaps 或 xamarin.maps 有类似的东西吗? 我只是希望能够点击地图附带的 POI 图标。

另一种实现是用丑陋的标记加载地图的整个视口......我有点想避免它。

(init)
googlemap.MapClicked += Googlemap_MapClicked;

async void Googlemap_MapClicked(object sender, MapClickedEventArgs e){
/* HERE I WANT TO ACTUALLY GET SOME SORT OF POI INFORMATION THAT WAS CLICKED*/

/* ORIGINAL CODE */
google_results_layout.IsVisible = false;
GooglePlace place = await vm.GetMostLikelyPlace(e.Point.Latitude, e.Point.Longitude);
if (place == null)
  await DisplayAlert("Place Not Found!", "Place was not found via Google.", "OK");
else
  vm.SetSelectedLocation(place);
}

【问题讨论】:

标签: google-maps xamarin xamarin.forms xamarin.android xamarin.ios


【解决方案1】:

https://github.com/sp1008/Xamarin.Forms.GoogleMaps

我不知道这是否公开,但我分叉了 amay077 的 git 并对它进行了 poi 更改。事实证明它比我预期的要简单。

附:我只为 Android 和 IOS 做过。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-08-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多