android中 InputMethodManager类已经有对此事件的处理了代码如下:
private InputMethodManager manager=null;
manager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
@Override
public boolean onTouchEvent(MotionEvent event) {
// TODO Auto-generated method stub
if (event.getAction() == MotionEvent.ACTION_DOWN) {
if (getCurrentFocus() != null
&& getCurrentFocus().getWindowToken() != null) {
manager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
}
}
return super.onTouchEvent(event);
}
---Linux社区