InputMethodManager imm= (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
@Override
public boolean onTouchEvent(MotionEvent event) {
// TODO Auto-generated method stub
if (event.getAction() == MotionEvent.ACTION_DOWN) { if (myActivity.this.getCurrentFocus() != null) {
if (myActivity.this.getCurrentFocus().getWindowToken() != null) {
imm.hideSoftInputFromWindow(myActivity.this.getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
}
}
}
return super.onTouchEvent(event);
}
Android 點擊EditText的時候彈出軟鍵盤,點擊EditText之外空白處軟鍵盤消失
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.