[英]How to change the color of Year Picker and Month picker chevron on the Android Material Date Picker?
From further on please post what you have tried to do so far so it shows that you have done some research.从进一步开始,请发布您迄今为止尝试做的事情,以表明您已经进行了一些研究。
Yes you can change the color of both, Add the following是的,您可以更改两者的颜色,添加以下内容
<style name="MaterialCalendarTheme" parent="ThemeOverlay.MaterialComponents.MaterialCalendar">
<!-- just override the colors used in the default style -->
<item name="colorOnPrimary">@color/white</item>
<item name="colorPrimary">@color/spruce_valencia</item>
<item name="materialCalendarHeaderTitle">@style/date_text_appearance</item>
<item name="cardCornerRadius">@dimen/card_corner_radius</item>
<item name="shapeAppearanceSmallComponent">@style/ShapeAppearance.App.SmallComponent</item>
<item name="shapeAppearanceMediumComponent">@style/ShapeAppearance.App.MediumComponent</item>
<!-- With following you can change change and update the tint, text colors , sizes etc of Month & Year -->
<item name="materialCalendarMonthNavigationButton">@style/navigationButtonMonthStyle</item>
<item name="materialCalendarYearNavigationButton">@style/navigationButtonYearStyle</item>
</style>
Month Pagination theme can be customised from this月分页主题可以从此自定义
<style name="navigationButtonMonthStyle" parent="Widget.MaterialComponents.Button.TextButton.Dialog.Flush">
<item name="iconTint">@color/spruce_valencia</item> <!-- This will change month pagination chevron color -->
</style>
Year theme can be customised from this年份主题可以从此定制
<style name="navigationButtonYearStyle" parent="Widget.MaterialComponents.Button.TextButton.Dialog.Flush">
<item name="iconTint">@color/error_color</item> <!-- This will change Year icon color -->
<item name="android:textColor">@color/error_color</item> <!-- This will change Year text color -->
</style>
for more information about customisation please check out this google repo link here有关自定义的更多信息,请在此处查看此 google repo 链接
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.