这里的问题:当我点击确定按钮,也就是 AlertDialog 里的 PositiveButton 的时候,我们需要判断用户是输入是否符合我们的预期,如果不符合通常提示用户重写输入,且不关闭当前的对话框,但上图中点击按钮后会自动的关闭窗口。
先看原来的这个是怎么写的:
private void openDialog() {
LinearLayout linearLayout = (LinearLayout) LayoutInflater.from(getContext()).inflate(R.layout.change_password_dialog, null);
final EditText originPasswordEt = (EditText) linearLayout.findViewById(R.id.origin_password);
TextView forgetPassword = (TextView) linearLayout.findViewById(R.id.forget_password);
final AlertDialog dialog = new AlertDialog.Builder(getContext())
.setView(linearLayout)
.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override