1、EditText有焦点(focusable为true)阻止输入法弹出
2、当EidtText无焦点(focusable=false)时阻止输入法弹出
转自:http://blog.csdn.net/kmyhy/archive/2010/11/18/6018865.aspx
editText=(EditText)findViewById(R.id.txtBody);
editText.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
editText.setInputType(InputType.TYPE_NULL); // 关闭软键盘
return false;
}
});
2、当EidtText无焦点(focusable=false)时阻止输入法弹出
InputMethodManager imm = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
转自:http://blog.csdn.net/kmyhy/archive/2010/11/18/6018865.aspx