我正在尝试使用Material Range Date Picker重现此样式:
[日历日期选择器,所有选定的日期的文本颜色为白色。未选定的日期的文本颜色为黑色]
目前我已经实现了以下效果:
[日历日期选择器,仅有所选边界日期的文本颜色为白色。未选定的日期的文本颜色为黑色,所选范围内的日期文本颜色也为黑色]
<style name="MyMaterialCalendarTheme" parent="ThemeOverlay.MaterialComponents.MaterialCalendar">
<item name="colorOnSurface">@color/black</item>
<item name="materialCalendarStyle">@style/MyMaterialCalendarStyle</item>
</style>
<style name="MyMaterialCalendarStyle" parent="Widget.MaterialComponents.MaterialCalendar">
<item name="rangeFillColor">@color/dark_green</item>
<item name="daySelectedStyle">@style/MyDaySelectedStyle</item>
</style>
<style name="MyDaySelectedStyle" parent="Widget.MaterialComponents.MaterialCalendar.Day.Selected">
<item name="itemTextColor">@color/white</item>
</style>
显然,colorOnSurface
属性设置日历中所有日期的文本颜色,而 daySelectedStyle
属性仅为起始和结束日期对应的日期设置文本颜色。
是否有一种方法可以将起始日期和结束日期之间的日期文本颜色设置为白色,同时保持未选中日期的文本颜色为黑色?