Search code examples
javaandroidandroid-theme

How to change MaterialAlertDialog theme


Here is a dialog, how to change this color (unchecked)?

screenshot

I try to set style but not work:

 <style name="ThemeMyAppDialogAlertDay"  
   parent="ThemeOverlay.MaterialComponents.MaterialAlertDialog">
    <item name="colorPrimary">@color/color_secondary</item>
    <item name="colorPrimaryVariant">@color/color_primary_variant</item>
    <item name="colorOnPrimary">@color/color_secondary</item>
    <item name="colorSecondary">@color/color_secondary</item>
    <item name="colorAccent">@color/color_error</item>
</style>

Solution

  • You can use:

     <style name="ThemeMyAppDialogAlertDay"  
       parent="ThemeOverlay.MaterialComponents.MaterialAlertDialog">
         <item name="colorSecondary">@color/selected</item> <!-- selected -->
         <item name="colorControlNormal">@color/unselected</item> <!-- unselected -->
     </style> 
    

    enter image description here