4
有沒有一種方法可以在運行時禁用AlertDialog的肯定按鈕,比如說在TextWatcher中?如何在運行時禁用AlertDialog的正向按鈕?
AlertDialog.Builder(this)
.setTitle(getString(R.string.createvfs))
.setView(newVSView_v11)
.setPositiveButton(getString(R.string.okay),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int whichButton) {
}
})
.setNegativeButton(getString(R.string.cancel),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int whichButton) {
// Canceled.
}
}).show();
我HUST要禁用按鈕,我想你的代碼,但它的fs因爲dialog.getButton (DialogInterface.BUTTON_POSITIVE)返回null。 :S – 2012-04-25 23:03:09