相关疑难解决方法(0)

如何防止AlertDialog关闭?

我正在使用AlertDialog.Builder来构建我的对话框,它有一个需要填充的EditText,我想阻止关闭对话框,而不是.在正面按钮的onClickListener中,我可以检查editText是否已填充,但我不知道如何阻止关闭...

builder.setPositiveButton("title", new DialogInterface.OnClickListener(){
     @Override
     public void onClick(DialogInterface dialog, int which) {
           if(...){
              //can close
           }else{
            //prevent closing
           }
     }
})
Run Code Online (Sandbox Code Playgroud)

android android-alertdialog onclicklistener

4
推荐指数
1
解决办法
2万
查看次数