How to change the text color of items in MaterialAlertDialog?

I am trying to change the text color of the items in a single choice MaterialViewAlertDialog. I achieved to change the “RadioButton” color and the title color but I can’t change the text color of the items. For now I am using the following style:

<style name="AlertDialog" parent="ThemeOverlay.MaterialComponents.Dialog.Alert">
        <item name="android:titleTextColor">@color/colorText</item>
        <item name="android:textColorSecondary">@color/colorText</item>
        <item name="android:textColorAlertDialogListItem">@color/colorText</item>

I also tried to cahnge the text color of the items with textAppearanceListItem but it didn’t work.


To change the color of the text in the items you can use something like:

<style name="AlertDialog" parent="@style/ThemeOverlay.MaterialComponents.MaterialAlertDialog">
    <item name="android:checkedTextViewStyle" ns2:ignore="NewApi">@style/myCheckedTextView</item>


  <style name="myCheckedTextView" parent="@style/Widget.MaterialComponents.CheckedTextView">
    <item name="android:textColor">@color/.....</item>

Otherwise you can also use:

<style name="AlertDialog"  
     <item name="colorSecondary">@color/selected</item> <!-- selected -->

enter image description here

Leave a Reply

Your email address will not be published. Required fields are marked *