2
我在我的Android應用程序中使用TabHost。當用戶更改爲某個選項卡時,我想要關閉軟鍵盤。更改標籤時關閉Android軟鍵盤
我在我的Android應用程序中使用TabHost。當用戶更改爲某個選項卡時,我想要關閉軟鍵盤。更改標籤時關閉Android軟鍵盤
你嘗試過:
開啓:
inputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
// only will trigger it if no physical keyboard is open
mgr.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
要關閉
InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
mgr.hideSoftInputFromWindow(editText.getWindowToken(), 0);
((InputMethodManager)GetSystemService(Context.InputMethodService)).ToggleSoftInput(ShowShoftInputFlags.None, HideSoftInputFlags.None);
添加一個解釋將使答案,甚至更好。 – 2012-11-06 18:03:38