c# - 如何使用 C# 在 xamarin.forms 中获取所有启用的键盘
问题描述
再会,
在 android 手机 -> 虚拟键盘中,系统列出此页面中所有启用的键盘,如何在我的 Xamarin.forms APP 中使用 C# 获取所有启用的键盘类型?
谢谢!卷
解决方案
在 Android 中,您可以使用InputDevice
.
InputDevice
:https ://developer.android.com/reference/android/view/InputDevice
你可以试试下面的代码:
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;
}
您可以使用DependencyService
在 Xamarin.Forms 中调用它。
DependencyService
:https ://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/dependency-service/introduction
推荐阅读
- python - 有没有一种简单的方法可以在 Airflow 中跳过整个 DAG 运行但仍允许未来运行?
- typescript - TypeScript 从其参数类型映射函数的返回类型
- angular - Angular/Typescript 在编译时删除未使用的代码
- swift5 - 在真实设备上查看屏幕错位
- javascript - 我正在创建一个 DOM 元素数组并选择一个 img 标签,然后是一系列 p 标签,如何从 img 获取 p 和 src 链接的 innerHTML?
- python-3.x - Python3 asyncio产生新线程时线程中没有当前事件循环
- c# - 转换列表
到字符串 C# - asp.net - sql server - - python - pandas:数据帧逐行比较
- go - 使用 RSA/PEM 文件解密测试消息时出错
- java - 根据行和列和恢复0-1矩阵