How to change DatePicker's CalendarView's background color in Lollipop?

[亡魂溺海] 提交于 2019-12-04 16:51:24

Any code using reflection may break on future OS updates. You should never use reflection to access private APIs or values.

The easiest way would be to create an overlay theme that redefines android:colorAccent and apply that to your DatePicker.

res/values/styles.xml:

<style name="MyThemeOverlay">
    <item name="android:colorAccent">@color/my_accent</item>
</style>

res/layout/my_layout.xml:

<DatePicker
    ...
    android:theme="@style/MyThemeOverlay" />

if you want to do it programmatically without xml, follow this link

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!