How to create dialog like this?

Viewed 12

How to create dialog like this? Don't have to set custom .xml view. I tried to set the theme style but still not the same. Create dialog

AlertDialog mAlertDialog = new MaterialAlertDialogBuilder(MainActivity.this, R.style.AlertDialogTheme)
                    .setTitle("Title")
                    .setMessage("Your message goes here. Keep it short but clear.")
                    .setNegativeButton("Cancel", null)
                    .setPositiveButton("Go Settings", null)
                    .show();

file style AlertDialogTheme

<style name="Button.FullWidth" parent="Widget.MaterialComponents.Button.TextButton.Dialog">
    <item name="android:layout_width">0dp</item>
    <item name="android:layout_weight">1</item>
    <item name="android:maxWidth">@null</item>
    <item name="android:textAllCaps">false</item>
</style>

<style name="AlertDialogTheme">
    <item name="materialAlertDialogButtonSpacerVisibility">2</item>
    <item name="buttonBarPositiveButtonStyle">@style/Button.FullWidth</item>
    <item name="buttonBarNegativeButtonStyle">@style/Button.FullWidth</item>
    <item name="buttonBarNeutralButtonStyle">@style/Button.FullWidth</item>
</style>

Dialog

0 Answers
Related