我正在开发Xamarin Android应用程序。我在MvxFragment中使用编辑文本,但是当我在EditText中键入内容然后转到另一个片段时,键盘仍然处于打开状态,无法关闭或隐藏,直到我按键盘上的Return键。我可以关闭或隐藏该键盘吗?

最佳答案

关闭片段时,您需要调用如下代码:

公共无效的HideSoftKeyboard()
        {
            InputMethodManager管理器=(InputMethodManager)GetSystemService(Context.InputMethodService);
            manager.HideSoftInputFromWindow(CurrentFocus.WindowToken,0);
        }

将此添加到您的活动,然后从片段中调用它。

10-07 19:14
查看更多