在网上搜了一下,测试结果如下:仅供参考
android edittext不弹出软键盘方法一: (此方法会自动换行,但是会弹出软键盘)
在AndroidMainfest.xml中选择哪个activity,设置windowSoftInputMode属性为adjustUnspecified|stateHidden
例如:<activity android:name=".Main" edit.setInputType(InputType.TYPE_NULL); 2013.10.21 ============================ 今天 下午在运行项目的时候突然发现,点击EditText输入的时候,弹出的软键盘把整个布局都顶上去了, 在网上也是左找右找,都没有解决问题,因为我的是tabhost+fragment, 最后找到了一篇文章,在此感谢此文博主, http://blog.csdn.net/yx0628/article/details/9389181 我最终的解决办法也就是在Androidmanifest.xml中的MainAcitivty中添加了: <activity android:name="com.guangxun.marryhandsearch.view.MainActivity" 以上,希望对你有帮助!
android:label="@string/app_name"
android:windowSoftInputMode="adjustUnspecified|stateHidden"
android:configChanges="orientation|keyboardHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
让EditText失去焦点,使用EditText的clearFocus方法
例如:EditText edit=(EditText)findViewById(R.id.edit);
edit.clearFocus();
方法三:
强制隐藏Android输入法窗口 (此方法mouse在EditText中输入文本时会自动换行,但是会弹出软键盘)
例如:EditText edit=(EditText)findViewById(R.id.edit);
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(edit.getWindowToken(),0);
(此方法不会在EditText里输入文本时不会自动换行。但不会弹出软键盘)
例:EditText edit=(EditText)findViewById(R.id.edit);
android:theme="@android:style/Theme.NoTitleBar"
android:configChanges="orientation|keyboard|keyboardHidden|navigation"
android:windowSoftInputMode="adjustPan|stateVisible"
></activity>