Material Dialog - How to change color of Checkbox in single choice items?

47 views Asked by At

I am trying to change the color of radio button for Material Dialog, what possibility I found in the documentation here and here is to override the whole layout using app:singleChoiceItemLayout but is there a way to change only its color and retain any original configuration from MDC library?

enter image description here enter image description here

1

There are 1 answers

0
Bitwise DEVS On BEST ANSWER

I just the correct attribute to change it which is colorSecondary

Dialog Theme

<!-- AlertDialog theme on both light and night mode -->
    <style name="AppDialog" parent="ThemeOverlay.Material3.MaterialAlertDialog" tools:keep="@style/AppDialog">
        <!-- Radio color -->
        <item name="colorSecondary">@color/colorAccent</item>
        <!-- Background color -->
        <item name="colorSurface">@color/colorWhite_Primary</item>
        <!-- Message color -->
        <item name="colorOnSurfaceVariant">@color/colorPrimaryDark_White</item>
        <item name="buttonBarPositiveButtonStyle">@style/DialogButtonStyle</item>
        <item name="buttonBarNegativeButtonStyle">@style/DialogButtonStyle</item>
        <item name="alertDialogStyle">@style/MaterialAlertDialog.App</item>
        <item name="materialAlertDialogTitleTextStyle">@style/DialogTitleStyle</item>
        <item name="materialAlertDialogBodyTextStyle">@style/DialogBodyStyle</item>
    </style>

Usage in your app main theme

<style name="Theme.YourApp" parent="Theme.Material3.DayNight">

    <item name="materialAlertDialogTheme">@style/AppDialog</item>

</style>