我怎么知道键盘是开放的

时间:2015-09-10 04:58:16

标签: android

我如何才能知道键盘是否打开。实际上我的问题是如果键盘打开,那么我只会呼叫隐藏,而不是总是调用hide。有什么方法可以检查键盘是否打开?目前我正在使用这种方法来隐藏键盘。

EditText myEditText = (EditText) findViewById(R.id.myEditText);
View view = this.getCurrentFocus();
if (view != null) {ditText) findViewById(R.id.myEditText);
View view = this.getCurrentFocus();
if (view != null) { Inp` 
im.hideSoftInputFromWindow(view.getWindowToken(), 0);

0 个答案:

没有答案