2012-03-07 84 views
2

我有一個Android應用程序和幾個edittext框。我遇到的問題是當您打開我不想要的這個屏幕時,鍵盤自動彈出。這隻發生在平板電腦上,鍵盤沒有顯示的手機上。我已將此代碼添加到我的onCreate中,但它沒有任何區別。隱藏平板電腦上的軟鍵盤無法使用?

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

任何想法,爲什麼鍵盤會不會在手機上,但在平板電腦上顯示它表明每一次?

回答

4

嘗試添加到您的活動在AndroidManifest.xml這一行: 機器人:windowSoftInputMode = 「stateHidden」

<activity 
     android:label="eMuse" 
     android:windowSoftInputMode="stateHidden" 
     android:name=".MainClass" > 
     <intent-filter > 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity>