我在Manifest中使用了
android:windowSoftInputMode="stateVisible"
属性的Edittext。现在当我启动这个Activity时,键盘会自动弹出。如何隐藏它?我不能使用android:windowSoftInputMode="stateHidden"
,因为当键盘可见时,最小化应用程序并恢复它后,键盘应该保持可见状态。
我尝试过以下代码,但是它没有起作用:
InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);