mPassword = (EditText) mView.findViewById(R.id.login_edittext_userpassword);
mPassword.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if(actionId == 0){
/*隐藏软键盘*/
InputMethodManager imm = (InputMethodManager) v
.getContext().getSystemService(
Context.INPUT_METHOD_SERVICE);
if (imm.isActive()) {
imm.hideSoftInputFromWindow(
v.getApplicationWindowToken(), 0);
}
checkLogin();
return false;//这里要return false 否则会密码无效
}
return false;
}
});
原文:http://670176656.blog.51cto.com/4500575/1640353