問(wèn)題描述
我正在制作一個(gè)應(yīng)用程序,其中有一個(gè)警報(bào)對(duì)話框.
I am making an application and it has an Alert Dialog in it.
現(xiàn)在我正在檢查我在對(duì)話框正按鈕 OnClick 方法中從 AlertDialog editTexts 獲得的一些數(shù)據(jù),但如果我從 edittext 字段獲得的數(shù)據(jù)正確與否,對(duì)話框總是會(huì)關(guān)閉.
Now i am checking some data I got from AlertDialog editTexts in dialog Positive button OnClick method but the dialog always dismiss if data i got from edittext fields is correct or not.
我們?nèi)绾谓么斯δ?
更新:
我正在從對(duì)話框中獲取 Pin 碼和確認(rèn) Pin 碼,在 onPositive 單擊中我已檢查以驗(yàn)證 pin 碼.
I am gettin Pin Code and Confirm Pin Code from the Dialog Box and in onPositive click i have checked to verify the pin codes.
現(xiàn)在,如果 pin 碼匹配,則調(diào)用 dialog.dismiss(),如果不匹配,則顯示 Toast.
Now if the pin codes matches then it is calling dialog.dismiss() and if not matching then display a Toast.
但如果密碼不匹配,它會(huì)向我顯示消息并關(guān)閉對(duì)話框.
But in case of pin code not matched it displays me the message and dismiss the dialog.
我不希望這樣的事情發(fā)生.
I dont want that to be happen.
更多更新:
有什么方法可以禁用確定"按鈕,并在驗(yàn)證數(shù)據(jù)后啟用肯定按鈕?
is there any way that i will disable the OK Button and when data is verified it will enable the positive Button??
請(qǐng)幫忙
推薦答案
Cap.謝謝你的幫助.通過(guò)您的指南,我知道我可以禁用警報(bào)對(duì)話框按鈕.是的!可以禁用按鈕.
Cap. Thanks for your help. through your guides i have got to know that i can disable the Alert Dialog Button. YES! its possible to disable the buttons.
答案是:
我們可以使用以下方法禁用按鈕:
we can disable the button using:
Button pos = Dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
pos.setEnabled(true);
這篇關(guān)于android中的警報(bào)對(duì)話框不應(yīng)關(guān)閉的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!