We can force Android to hide the virtual keyboard using the inputMethodManager.
For example you have EditText like this:
EditText myText = (EditText)findViewById(R.id.login);
relativeLayout.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
InputMethodManager inputMethodManager = (InputMethodManager)
getSystemService(activity.INPUT_METHOD_SERVICE);
//here activity is your activity class
inputMethodManager.hideSoftInputFromWindow(myText.getWindowToken(),0);
return false;
}
});
No comments:
Post a Comment