我的布局中有一个EditText和一个Button.
在编辑字段中写入并单击后Button,我想隐藏虚拟键盘.我假设这是一段简单的代码,但我在哪里可以找到它的一个例子?
android soft-keyboard android-layout android-softkeyboard android-input-method
我试图在一个Activity中强制打开Soft Keyboard并抓取输入的所有内容,因为我想自己处理输入,我没有EditText.目前我已经尝试了这个,但它不起作用.我想在mAnswerTextView下打开Soft Keyboardto(注意:它是TextView而不是EditText).
InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
// only will trigger it if no physical keyboard is open
mgr.showSoftInput(mAnswerTextView, InputMethodManager.SHOW_IMPLICIT);
Run Code Online (Sandbox Code Playgroud)