阻止EditText弹出输入法

//当EidtText获取焦点,此方法不能阻止输入法弹出
			InputMethodManager imm = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);   
			//imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);  


//EditText有焦点阻止输入法弹出
			editText.setOnTouchListener(new OnTouchListener() {
				
				public boolean onTouch(View v, MotionEvent event) {
					// TODO Auto-generated method stub
					//记住EditText的InputType现在是password 
					int inType = editText.getInputType(); // backup the input type
					editText.setInputType(InputType.TYPE_NULL); // disable soft input    
					editText.onTouchEvent(event); // call native handler    
					editText.setInputType(inType); // restore input type   
					editText.setSelection(editText.getText().length());
					return true;
					
				}
			});

你可能感兴趣的:(xml)