EditText自动弹出软键盘的原因及解决方法
16lz
2021-01-26
部分内容来源于http://blog.csdn.net/cshichao/article/details/8536961
一.产生原因
EditText自动获取到了焦点,所以弹出软键盘,so...解决问题的方法也就是不让他获取到焦点就行。
二.解决方法
(1)在父容器中添加这两段代码(亲测有效)
android:focusable="true" android:focusableInTouchMode="true"
(2)在清单文件(AndroidMainifest)中添加 (亲测有效)
android:windowSoftInputMode="stateHidden"
EditText edit = (EditText)findViewById(R.id.edit); edit.clearFocus();
EditText edit = (EditText)findViewById(R.id.edit); InputMethodManager imm = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(edit.getWindowToken(), 0);
EditText edit = (EditText)findViewById(R.id.edit); edit.setInputType(InputType.TYPE_NULL);
更多相关文章
- TextView文字横向自动滚动(跑马灯)
- android点击EditText外区域收起键盘
- Can't create handler inside thread that has not called Loope
- Android(安卓)focus search returned a view that wasn't able t
- dex2oat的原理及慢的原因
- Android软键盘一些处理
- Android(安卓)Studio 安装完成后,遇到的问题记录。
- 关于Android中Animation的停止
- android右上方不显示3个点的菜单的解决方法