Alertdialog with background

Asked

Viewed 96 times

0

I created this alertDialog but I wonder if instead of having an icon when it appears, if it is possible to all have another color or even use an image like yours (Background). E Assign to the buttons a background.

public void icon (View View){
        AlertDialog.Builder dialog = new AlertDialog.Builder (this);
        dialog.setMessage("Exemplo com icon");
        dialog.setPositiveButton("NEXT", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                setContentView(R.layout.next);
            }
        });
        dialog.setTitle("Icone");
        dialog.setIcon(R.drawable.buttonum);
        dialog.show();
    }

1 answer

2


You can create a layout.xml and add to Alertdialog

final AlertDialog dialog = new AlertDialog.Builder(suaActivity.this)
                    .setView(R.layout.seulayout)
                    .create();
  • Thank you so much for your help. But I still have a problem. In the layout I created has a button and when I load it opens another layout but does not close the alertdialog

  • uses dialog.Dismiss when you want to close

  • 1

    Thank you very much Icaro ;)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.