0

I'm currently working on creating a custom theme for a datePicker and I'm having some difficulty with setting the headerBackground and the circle around the selected date separately. I've set my theme up like this:

<style name="State0DatePickerTheme" parent="AppTheme">
    <item name="colorAccent">@color/state0Dark</item>
    <item name="android:headerBackground">@color/state0Primary</item>
</style>

App theme looks like this:

<style name="AppTheme" parent="State0BaseTheme">
    <item name="colorPrimary">@color/state0Primary</item>
    <item name="colorPrimaryDark">@color/state0Dark</item>
    <item name="android:statusBarColor">@color/state0Primary</item>
    <item name="android:colorControlNormal">@color/colorAccent</item>
    <item name="android:background">@color/state0Primary</item>
    <item name="android:textColorPrimary">@color/colorAccent</item>
</style>

And last but not least, State0BaseTheme looks like this:

<style name="State0BaseTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="colorPrimary">@color/state0Primary</item>
    <item name="colorPrimaryDark">@color/state0Dark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="android:statusBarColor">@color/state0Primary</item>
    <item name="android:colorControlNormal">@color/colorAccent</item>
    <item name="android:background">@color/state0Primary</item>
    <item name="android:textColorPrimary">@color/colorAccent</item>
</style>

I had thought that overriding colorAccent, and setting headerBackground would work just fine, but I guess not? Here's what it looks like with all these styles:

If I set android:headerBackground in the xml of the datePicker, everything works great. However, I want to be able to change the theme for all screens of the app based on user input. Thoughts as to why this isn't working?

Jacob
  • 363
  • 4
  • 12

1 Answers1

0

I read the link posted by @DasserBasyouni and found that making the parent of my datePickerTheme @android:style/Widget.Material.Light.DatePicker and setting android:datePickerStyle to @style/State0DatePickerTheme in State0BaseTheme worked perfectly

Jacob
  • 363
  • 4
  • 12