方法一:android
在AndroidMainfest.xml中選擇哪一個activity,設置windowSoftInputMode屬性爲adjustUnspecified|stateHidden安全
例如:app
<activityandroid:name=".Main"android:label="@string/app_name"android:windowSoftInputMode="adjustUnspecified|stateHidden"android:configChanges="orientation|keyboardHidden"><intent-filter><actionandroid:name="android.intent.action.MAIN"/><categoryandroid:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>ide
方法二:測試
讓EditText失去焦點,使用EditText的clearFocus方法spa
例如:xml
EditText edit=(EditText)findViewById(R.id.edit); edit.clearFocus();ci
方法三:get
強制隱藏Android輸入法窗口string
例如:
EditTextedit=(EditText)findViewById(R.id.edit); InputMethodManagerimm= (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);imm.hideSoftInputFromWindow(edit.getWindowToken(),0);
2.EditText始終不彈出軟件鍵盤
例:
EditText edit=(EditText)findViewById(R.id.edit); edit.setInputType(InputType.TYPE_NULL);
以上。另外對APP進行在線全方位的安全性、兼容性測試,我都會用這個:www.ineice.com。