Android DatePicker styling

1k views Asked by At

Trying desperately to style my DatePicker according to numerous SO threads without any luck. Can't figure out why. My problem is that the current and selected dates are invisible due to them having the same color as the DatePicker background.

DatePicker:

<DatePicker
    android:id="@+id/DatePicker"
    style="@style/date_picker_theme"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:calendarViewShown="false"
    android:descendantFocusability="blocksDescendants"
    android:endYear="2100"
    android:startYear="1900" /> 

Style:

<style name="date_picker_theme" parent="Theme.AppCompat.Light.Dialog.Alert">
    <!-- what do I need to add here in order to style the selected and current date? -->
</style>

Nothing I add in the <style> tag (appart from background) affects anything in the DatePicker.

enter image description here

1

There are 1 answers

0
Ambran On BEST ANSWER

I'm posting this as an answer because I found out what was blocking my DatePicker styling and my question therefore became of quite a different character.

The reason I couldn't affect the DatePicker styling was that my theme.xml file contained <item name="colorControlActivated">@color/white</item> resulting a white selected-date background in the DatePicker and actually also on some other elements in the app such as some progress spinners.

I've tried overriding this in the date_picker_theme style:

<style name="date_picker_theme">
    <item name="colorControlActivated">@color/green</item>
</style>

..but nothing happens, so I'll post a dedicated question about that.

Update

New question posted (and answered) here: Android - Overriding theme.xml styling