android顯示和隱藏輸入法

方法一:    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);   imm.showSoftInput(m_receiverView(接受軟鍵盤輸入的視圖(View)),InputMethodManager.SHOW_FORCED(提供當前操做的標記,SHOW_FORCED表示強制顯示));  方法二:     InputMethodManager m=(InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);       m.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS); (這個方法能夠實現輸入法在窗口上切換顯示,若是輸入法在窗口上已經顯示,則隱藏,若是隱藏,則顯示輸入法到窗口上)  2.調用隱藏系統默認的輸入法     ((InputMethodManager)getSystemService(INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(MainActivity.this.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); 3.獲取輸入法打開的狀態     InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);       boolean isOpen=imm.isActive();  
相關文章
相關標籤/搜索