[英]How to get all enabled keyboard in xamarin.forms with C#
Good day,再会,
in android phone -> virtual keyboard, system list all the enabled keyboards in this page, how can i get all enabled keyboards type with C# in my Xamarin.forms APP?在 android 手机 -> 虚拟键盘中,系统列出此页面中所有启用的键盘,如何在我的 Xamarin.forms APP 中使用 C# 获取所有启用的键盘类型?
Thanks!谢谢! Roll
卷
In Android, you could use InputDevice
.在 Android 中,您可以使用
InputDevice
。
InputDevice
: https://developer.android.com/reference/android/view/InputDevice输入设备:
InputDevice
://developer.android.com/reference/android/view/InputDevice
You could try the code below:你可以试试下面的代码:
int[] devicesIds = InputDevice.GetDeviceIds();
foreach (var item in devicesIds)
{
//Check the device you want
InputDevice device = InputDevice.GetDevice(item);
//device.getName must to have virtual
var s = device.Name;
var b = device.KeyboardType;
}
You could use DependencyService
to call this in Xamarin.Forms.您可以使用
DependencyService
在 Xamarin.Forms 中调用它。
DependencyService
: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/dependency-service/introduction DependencyService
服务: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/dependency-service/introduction
thanks your reply, i try the way you suggested, but the returned value was not i want...感谢您的回复,我尝试了您建议的方式,但返回的值不是我想要的...
i found another post here , use that way and finally get the things i want,我在这里找到了另一个帖子,使用这种方式并最终得到我想要的东西,
here is my code to share:这是我要分享的代码:
InputMethodManager manager = (InputMethodManager)context.GetSystemService(Context.InputMethodService);
IList<InputMethodInfo> mInputMethodProperties = manager.EnabledInputMethodList;
IEnumerator<InputMethodInfo> imi = mInputMethodProperties.GetEnumerator();
while (imi.MoveNext())
{
InputMethodInfo inputInfo = imi.Current;
var iN = inputInfo.ServiceName;
}
Best Regards & thanks最好的问候和感谢
Roll卷
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.