I want to use new material outlined buttons with default alert dialog.
I have created style in style.xml as below
<style name="OutlinedButton" parent="Widget.MaterialComponents.Button.TextButton">
<item name="strokeColor">@color/colorAccent</item>
<item name="strokeWidth">2dp</item>
</style>
<style name="MaterialDialogStyle" parent="Theme.MaterialComponents.Dialog.Alert">
<item name="android:textColorPrimary">@color/colorAccent</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="colorPrimary">@color/colorAccent</item>
<item name="buttonStyle">@style/OutlinedButton</item>
</style>
I am using new Material Components theme to style Yes and No Buttons.
Now I use above style in my code by setting it to AlertDialog builder.
AlertDialog.Builder builder = new AlertDialog.Builder(ProductListActivity.this, R.style.MaterialDialogStyle);
Is there a way to use latest material outlined buttons with Default Alert Dialog? I am using Material components from design support library if it makes any difference.


AndroidXthen import the androidX import. After, add material design dependency to see the result. I guess this will work better with the new AndroidX and the Material Design dependency added. - ʍѳђઽ૯ทare available with support library) Why not checking withv7 AlertDialogimport too? or simply, using AndroidX dependency-import? - ʍѳђઽ૯ท