2013-04-09 18 views
1

我的主屏幕有四個選項卡,其中一個需要用戶輸入。在輸入選項卡中輸入數據時,鍵盤會打開。當我切換到其他選項卡時,此鍵盤保持打開狀態。任何關於我需要做什麼的建議?軟鍵盤在改變標籤後仍然可見

+0

http://stackoverflow.com/questions/10297376/how-do-i-hide-the-soft-keyboard-when-changing-tabs – 2013-04-09 10:19:26

+0

[見本 - ] [1 ] http://stackoverflow.com/questions/1109022/close-hide-the-android-soft-keyboard?rq=1 [1]:http://stackoverflow.com/questions/1109022/ close-hide-the-android-soft-keyboard?rq = 1 – Neo 2013-04-09 10:20:20

回答

1

以下代碼複製自Close/hide the Android Soft Keyboard

下一次,請搜索論壇上發帖提問前:用Activitydeclaire

tabHost.setOnTabChangedListener(new OnTabChangeListener() 
     { 
     public void onTabChanged(String tabId) 
      { 
      InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); 
      imm.hideSoftInputFromWindow(tabHost.getApplicationWindowToken(), 0); 
      } 
     } 
+0

明白了!事實上我發佈了我從我的答案中獲得答案的鏈接。我現在應該刪除該問題嗎? – 2013-04-09 10:37:28

+0

上面的代碼片段應以()結束; – 2013-06-22 20:11:08

0

這或許可以幫助你,在你Manifest這樣

<activity android:windowSoftInputMode="adjustResize" /> 

<activity android:windowSoftInputMode="adjustPan" /> for more info 

see Here

<activity 
     android:name=".Home" 
     android:configChanges="keyboardHidden|orientation"> 
    </activity> 
+0

試過,這個但是dint爲我工作。 http://stackoverflow.com/questions/10297376/how-do-i-hide-the-soft-keyboard-when-changing-tabs這是什麼爲我工作。 謝謝你的時間。 – 2013-04-09 10:45:21

+0

現在檢查並再試一次 – 2013-04-09 10:47:41