我有一些密码:
inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0, new ResultReceiver(null) {
@Override
protected void onReceiveResult(int resultCode, Bundle resultData) {
keyboardClosed();
}
});但是,在4.3仿真器上运行这个方法-- onReceiveResult()方法永远不会被调用。我肯定我做错了什么,但我看不出.
有人能向我提供一些细节,如何正确地做到这一点,或为什么它不起作用?
发布于 2017-04-25 09:55:27
如果ResultReceiver返回false,则不调用false。
您可以检查此值:
boolean hide = inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0, new ResultReceiver(null) {
@Override
protected void onReceiveResult(int resultCode, Bundle resultData) {
keyboardClosed();
}
});
if (!hide) {
// already hidden
keyboardClosed();
}https://stackoverflow.com/questions/27858333
复制相似问题