簡體   English   中英

如何在 Xamarin.Forms 中使用 Xamarin.GooglePlayServices.Maps?

[英]How use a Xamarin.GooglePlayServices.Maps in Xamarin.Forms?

我需要在我的 Xamarin.Forms 應用程序中使用 Xamarin.GooglePlayServices.Maps。 但是我在共享項目(例如 App)中編寫了所有頁面,並且只能在 android 項目(App.Android)中安裝 Xamarin.GooglePlayServices.Maps。 我可以在我的共享項目 (App) 中使用這個包 (Xamarin.GooglePlayServices.Maps) 嗎?

改為下載“Xamarin.Forms.Maps”。 它依賴於“Xamarin.GooglePlayService.Maps”等等。

就像HeroesVII說,安裝Xamarin.Forms.Maps的Xamarin.Forms。 下面的代碼示例供您參考。

Xamarin.Forms在Android上顯示地圖並與之交互的配置過程為:

  1. 獲取 Google Maps API 密鑰並將其添加到清單中。
  2. 在清單中指定 Google Play 服務版本號。
  3. 在清單中指定對 Apache HTTP Legacy 庫的要求。

有關步驟的詳細信息,您可以查看 MS 文檔。

您可以從下面的鏈接下載源文件。 https://docs.microsoft.com/en-us/samples/xamarin/xamarin-forms-samples/workingwithmaps/

我建議你,因為@HeroesVII 說你應該嘗試 Xamarin.Forms.Maps,它更輕量級和簡單化。 無論哪種方式,如果您想堅持使用 Xamarin.GooglePlayServices.Maps,那么它在標准項目中應該沒有任何問題。

你可以找到和例子在這里以這種回購約我兩天前創建。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM