如何隐藏softkeyboard? [英] how to hide the softkeyboard?
本文介绍了如何隐藏softkeyboard?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个显示视图的活动。该视图由各种窗口小部件,其中之一是一个多行的EditText的。当视图充气的softkeyboard来了如何禁用呢?
东西我曾尝试:
除去从的EditText内的布局以下
< requestFocus的/>
创建下面的方法,然后从onCreate方法调用它(分辨率是EditText上)。
私人无效hideSoftKeyboard(){ InputMethodManager IMM =(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(resolution.getWindowToken(),0); }
解决方案
添加到您的清单文件
的android:windowSoftInputMode =stateHidden
为
<活动机器人:名字=。youractivity
机器人:windowSoftInputMode =stateHidden < /活性GT;
I've an activity that displays a view. The view consists of various widgets, one of which is a multiline EditText. When the view is inflated the softkeyboard comes up how can i disable it?
Things i have tried:
removing the following from the layout from within the EditText.
<requestFocus />
.
creating the following method then calling it from the oncreate method (resolution is the EditText).
private void hideSoftKeyboard() {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(resolution.getWindowToken(), 0);
}
解决方案
Add this to your manifest file
android:windowSoftInputMode="stateHidden"
as
<activity android:name=".youractivity"
android:windowSoftInputMode="stateHidden"
</activity>
这篇关于如何隐藏softkeyboard?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文