如何阻止虚拟键盘,同时点击的EditText android系统中? [英] how to block virtual keyboard while clicking on edittext in android?
问题描述
如何阻止虚拟键盘
同时点击EditText上的机器人
How to block virtual keyboard
while clicking on edittext in android
推荐答案
<一个href="http://groups.google.com/group/android-developers/browse%5Fthread/thread/180530f680374493?pli=1">Here是一个网站,会给你你所需要的。
Here is a website that will give you what you need.
作为一个总结,它提供的链接 InputMethodManager
和查看
从Android开发人员。这将参照 getWindowToken
里面的查看
和 hideSoftInputFromWindow()
为 InputMethodManager
As a summary, it provides links to InputMethodManager
and View
from Android Developers. It will reference to the getWindowToken
inside of View
and hideSoftInputFromWindow()
for InputMethodManager
有一个更好的答案中给出的链接,希望这有助于。
A better answer is given in the link, hope this helps.
从上面贴的链接,下面是一个例子消耗onTouch事件:
From the link posted above, here is an example to consume the onTouch event:
editText_input_field.setOnTouchListener(otl);
private OnTouchListener otl = new OnTouchListener() {
public boolean onTouch (View v, MotionEvent event) {
return true; // the listener has consumed the event
}
};
下面是从同一网站的另一个例子。这要求工作,但似乎是因为一个坏主意,你的编辑框
是 NULL
将不再编辑:
Here is another example from the same website. This claims to work but seems like a bad idea since your EditBox
is NULL
it will be no longer an editor:
MyEditor.setOnTouchListener(new OnTouchListener(){
@Override
public boolean onTouch(View v, MotionEvent event) {
int inType = MyEditor.getInputType(); // backup the input type
MyEditor.setInputType(InputType.TYPE_NULL); // disable soft input
MyEditor.onTouchEvent(event); // call native handler
MyEditor.setInputType(inType); // restore input type
return true; // consume touch even
}
});
希望这点你在正确的方向。
Hope this points you in the right direction
这篇关于如何阻止虚拟键盘,同时点击的EditText android系统中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!