我必须集成国家代码微调器,以便在Xamarin中进行移动注册。我已将所有国家/地区名称成功插入微调器中,但我也想添加带有国家/地区名称的标志和代码。
[请提供给我在Spinner中用标志和代码添加国家/地区名称的最佳方法。我已经参考了一些教程,但是示例代码仅在Java中可用,并且我需要C#代码。
在Xamarin Forms中,没有ComboBox(您的图像似乎是ComboBox ...)。您可以使用@Alex建议的选择器。否则,您可以使用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
您正在使用Xamarin.Droid吗?如果是,则需要使用自定义适配器。
看看这个discussion