Let's see how to create custom Alert Dialogs in Android.
The main activity is described in MainActivity.java, and it is made of a button that, if clicked, leads to the visualization of the dialog.
Here's the code for the MainActivity:
As regards the custom dialog, its layout is defined in the file custom_dialog.xml:
The shape and the borders are defined in dialogs.xml, in the folder drawable:
You can download the complete example from our repository: Download CustomDialog.zip
The final result is the following: