我试图在活动中的片段内隐藏键盘时遇到这些错误:
错误:无法解析getSystemService
无法解析Context
无法解析getCurrentFocus()
InputMethodManager inputManager = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
Run Code Online (Sandbox Code Playgroud)