分享:EditText默认不弹出软件键盘

方法一: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失去焦点,使用EditTextclearFocus方法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

相关文章
相关标签/搜索