C# 如何检查设备上是否打开了软键盘
我必须检测软键盘是否已打开。我在这里读了一些关于如何做的文章,其中一个例子是>这试试这个:C# 如何检查设备上是否打开了软键盘,c#,android,xamarin.android,C#,Android,Xamarin.android,我必须检测软键盘是否已打开。我在这里读了一些关于如何做的文章,其中一个例子是>这试试这个: InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); if (imm.isAcceptingText()) { writeToLog("Software Keyboard was shown"); } else { write
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm.isAcceptingText()) {
writeToLog("Software Keyboard was shown");
} else {
writeToLog("Software Keyboard was not shown");
}
试试这个:
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm.isAcceptingText()) {
writeToLog("Software Keyboard was shown");
} else {
writeToLog("Software Keyboard was not shown");
}
无法检测是否显示软键盘,但您可以通过知道活动视图已调整大小来间接知道显示软键板 这两行隐藏了软键盘
var input = (InputMethodManager)GetSystemService(InputMethodService);
input.HideSoftInputFromWindow(editText1.WindowToken, HideSoftInputFlags.None);
也可以看到
var input = (InputMethodManager)GetSystemService(InputMethodService);
input.HideSoftInputFromWindow(editText1.WindowToken, HideSoftInputFlags.None);
也可以看到