Android/개발팁

SoftKeyboard 생성, 삭제

hoonihoon 2012. 8. 27. 09:41

생성

InputMethodManager inputMethodManager =
             (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
         inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);

 

생성시 인자에 대한 문제때문에 toggle로 하였다.

This method toggles the input method window display. If the input window is already displayed, it gets hidden. If not the input window will be displayed.

 

삭제

InputMethodManager inputMethodManager =
            (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
         inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(),0);