如何禁用/启用对话框的负面肯定按钮?
请查看下面的自定义对话框。我在对话框上有一个edittext字段,如果文本字段为空,我想禁用positiveButton。我可以为文本字段获取charListener,但不确定如何positivebutton从该侦听器设置为禁用或启用?正负按钮的参考是什么? case DIALOG_TEXT_ENTRY: // This example shows how to add a custom layout to an AlertDialog LayoutInflater factory = LayoutInflater.from(this); final View textEntryView = factory.inflate(R.layout.alert_dialog_text_entry, null); return new AlertDialog.Builder(AlertDialogSamples.this) .setIconAttribute(android.R.attr.alertDialogIcon) .setTitle(R.string.alert_dialog_text_entry) .setView(textEntryView) .setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { /* User clicked OK so do some …