Ant*_*ney 46
这是一个可以满足您需求的网站.
作为总结,它提供了InputMethodManager与ViewAndroid开发者之间的链接.它将引用getWindowToken内部View和hideSoftInputFromWindow()forInputMethodManager
链接中给出了更好的答案,希望这会有所帮助.
从上面发布的链接,这是一个使用onTouch事件的示例:
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
}
};
Run Code Online (Sandbox Code Playgroud)
这是同一网站的另一个例子.这要求工作,但似乎是一个糟糕的主意,因为你EditBox是NULL这将是不再编辑:
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 event
}
});
Run Code Online (Sandbox Code Playgroud)
希望这能指出你正确的方向
| 归档时间: |
|
| 查看次数: |
26215 次 |
| 最近记录: |