How to change background color of default warning dialog box for Android

I have a default warning dialog with a list of Text and Radio buttons.

I need to replace the image instead of text (replace the image instead of Facebook, credit card, PayPal, credit card shown below), and also change the background color of the dialog box.

I also put the style.xml file inside the values ​​folder.

How can I implement this file in the below code to change the background color?

My code is:

 final CharSequence[] items = {"Facebook credit", "Paypal", "Credit Card"};

            //ContextThemeWrapper ctw = new ContextThemeWrapper( this, R.style.AboutDialog );
            AlertDialog.Builder builder = new AlertDialog.Builder(paymentPage.this);
            builder.setTitle("Payment Gateway");
            builder.setIcon(R.drawable.gate);
            builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int item) {
                   // Toast.makeText(getApplicationContext(), items[item], Toast.LENGTH_SHORT).show();
                }
            });

            builder.setPositiveButton("Yes",
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            payPalPayment();
                        }


                    });
            builder.setNegativeButton("No",
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            Toast.makeText(paymentPage.this, "Fail", Toast.LENGTH_SHORT).show();
                        }
                    });
            AlertDialog alert = builder.create();
            alert.show();
        }
    });

My picture:

enter image description here

+5
source share
2 answers

. - . , AlertDialog. , AlertDialog, , .

- , .

.

, , .

.

0

All Articles