通常在app開發中都有這種操做,好比我點擊搜索後把鍵盤收回操做,這種狀況下面的兩行代碼能幫你解決。app
InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);