是否可以显示具有禁用项(行)的多选警报对话框? 通过在列表中检查“无”选项,应禁用列表中的所有选项,除了选项“无”,如果取消选中选项“无”,需要再次启用所有项目吗?
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context);
dialogBuilder.setMultiChoiceItems(optionsList,selectionState,new
DialogInterface.OnMultiChoiceListener()
{
@Override
public void onClick(DialogInterface dialog,int which, boolean isChecked){
final AlertDialog alertDialog = (AlertDialog) dialog;
final ListView alertDialogList = alertDialog.getListView();
// Here how to make the items in the list as disabled when None is clicked
// None OPtion is one among in optionsList string array
// A loop to disable all items other than clicked one
for (int position = alertDialogList.getCheckedItemPosition(); position<
alertDialogList.getChildCount; position++)
{
alertDialogList.getChildAt(position).setEnabled(false);
}
}
});