是否可以在列表中显示带有禁用项目(行)的多选警报对话框?通过选中列表中的“无”选项,列表中的所有选项都应该被禁用,除了“无”选项,如果我取消选中“无”选项需要再次启用所有项目吗?
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);
}
}
});