如何自定义AlertDialog单一选择中的视图



我想在Alertdialog单一选择中自定义我的视图在此处输入图像描述

如何制作?

如果您想要更多自定义选项

,请使用此功能
alertDialogue.setContentView(/*Layout*/)

,或者如果您想使用此选择。

alertDialogue.setMultiChoiceItems(R.array.toppings, null,
                      new DialogInterface.OnMultiChoiceClickListener() {
               @Override
               public void onClick(DialogInterface dialog, int which,
                       boolean isChecked) {
                   if (isChecked) {
                       // If the user checked the item, add it to the selected items
                       mSelectedItems.add(which);
                   } else if (mSelectedItems.contains(which)) {
                       // Else, if the item is already in the array, remove it
                       mSelectedItems.remove(Integer.valueOf(which));
                   }
               }
           })

检查Android指南

最新更新