Android 个工作室弹出图像按钮

Android studio popup image buttons

我正在 Android 工作室制作相同的应用程序,我需要一个图像弹出按钮来安装一个文本按钮。当级别失败或完成时,将显示该弹出窗口。我有这个文本按钮代码,但如何更改以插入一些图片而不是文本?

 AlertDialog.Builder builder = new AlertDialog.Builder(Level_1.this);
            final CharSequence[] levelOptions = {"Restart", "Next level"};
            builder.setTitle("CORRECT!").setItems(levelOptions , new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialogInterface, int which) {
                    Log.d("Restart", levelOptions[which].toString());
                }
            });
            AlertDialog dialog = builder.create();
            dialog.show();

获取警报对话框按钮

Button positive= alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);

设置可绘制图像

positive.setCompoundDrawablesWithIntrinsicBounds(this.getResources().getDrawable( R.drawable.pos), null, null, null);