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