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;
}
});
时间: 2024-10-10 12:02:02