【问题标题】:Integrate a country code picker in xamarin在 xamarin 中集成国家代码选择器
【发布时间】:2019-11-15 09:01:45
【问题描述】:
我必须在 Xamarin 中集成用于移动注册的国家/地区代码微调器。我已在微调器中成功插入所有国家/地区名称,但我还想添加带有国家/地区名称的标志和代码。
请提供在 Spinner 中添加带有标志和代码的国家/地区名称的最佳方式。我想要 C# 代码。
【问题讨论】:
标签:
c#
xamarin.android
spinner
mobile-country-code
【解决方案1】:
在 Xamarin Forms 中没有 ComboBox(您的图像似乎是 ComboBox...)。您可以像@Alex 建议的那样使用 Picker。否则,您可以使用 ListView 创建一个弹出页面。有一个很好的带有示例的插件
https://github.com/rotorgames/Rg.Plugins.Popup
这些是一些方法
// Use these methods in PopupNavigation globally or Navigation in your pages
// Open new PopupPage
Task PushAsync(PopupPage page, bool animate = true) // Navigation.PushPopupAsync
// Hide last PopupPage
Task PopAsync(bool animate = true) // Navigation.PopPopupAsync
// Hide all PopupPage with animations
Task PopAllAsync(bool animate = true) // Navigation.PopAllPopupAsync
// Remove one popup page in stack
Task RemovePageAsync(PopupPage page, bool animate = true) // Navigation.RemovePopupPageAsync