AlertDialog radiobutton 自定义主题

开发中经常遇到这种弹窗,系统颜色往往不合适,于是我们使用自定义style方式进行设置

最终效果
      String[] cameraNames = new String[]{"camera0","camera1"};
        AlertDialog.Builder alertBuilder = new AlertDialog.Builder(getContext(),R.style.alterAialogCustom);
        alertBuilder.setSingleChoiceItems(cameraNames, checkedItemIndex, (dialogInterface, i) -> {
            dialogInterface.dismiss();
        });
        alertBuilder.setPositiveButton(getString(R.string.cancel), (dialogInterface, i) -> dialogInterface.dismiss());
      AlertDialog alertDialog = alertBuilder.create();
      alertDialog.show();
        
    

你可能感兴趣的:(AlertDialog radiobutton 自定义主题)