Creating a custom theme for alertdialogue will change its appearance, in a way you want or to match your application theme and look. here i will explain how to do that with a few lines of code in java. what we have to do is create a new theme specially for alertdialogue and then refer to it from the code
First, go to res > values > styles.xml file. see the image below.
In styles.xml, create a new theme
<style name="MyAlertDialogTheme" parent="Theme.AppCompat.Dialog.Alert"> <item name="colorAccent">@color/coloraccent</item> <item name="android:colorBackground">@color/colorPrimaryDark</item> <item name="android:windowBackground">@color/colorPrimaryDark</item> </style>
And in your Activity
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.MyAlertDialogTheme); //here we refer to the theme we created in styles
For a detailed explanation of how to create an alertdialogue, go here