Lil*_*oke 1 android android-layout xamarin.android
我使用以下代码检测用户按键盘上的Return:
EditText etMyEditText = FindViewById<EditText>(Resource.Id.etMyEditText);
etMyEditText.KeyPress += (intentSender, e) =>
{
if (e.Event.Action == KeyEventActions.Down && e.KeyCode == Keycode.Enter)
{
e.Handled = true;
}
};
Run Code Online (Sandbox Code Playgroud)
但我想在按下返回键后关闭键盘.
任何人都可以阐明如何做到这一点?
谢谢您的帮助
这段代码将以编程方式关闭软键盘.
InputMethodManager manager = (InputMethodManager) GetSystemService(InputMethodService);
manager.HideSoftInputFromWindow(etMyEditText.WindowToken, 0);
Run Code Online (Sandbox Code Playgroud)
传递给的第二个参数manager.HideSoftInputFromWindow是flag哪一个
提供其他操作标志.当前可能为0或设置了HIDE_IMPLICIT_ONLY位.
| 归档时间: |
|
| 查看次数: |
4906 次 |
| 最近记录: |