Reputation: 17340
I am trying to change the colour of the Date picker, and the result I am getting is this
The bottom button bar is white in colour that hides the button texts as they are also in white colour. I want to change the button bar to black, but even adding a style for buttonBarStyle
and setting the background to black does not help. My xml is pasted below
<style name="DatePickerTheme_Dark" parent="Theme.AppCompat.Dialog">
<item name="colorAccent">@color/highlight_color_blue</item>
<item name="android:datePickerStyle">@style/MyDatePickerStyleDark</item>
<item name="buttonBarStyle">@style/mybuttonbar</item>
</style>
<style name="mybuttonbar" parent="Widget.AppCompat.ButtonBar.AlertDialog">
<item name="android:background">@color/background_color_black</item>
</style>
<style name="MyDatePickerStyleDark" parent="@android:style/Widget.Material.DatePicker">
<item name="android:headerBackground">@color/highlight_color_blue</item>
<item name="android:background">@color/background_color_black</item>
</style>
All I want to do now is set the bottom button bar style/colour to black.
I also tried to change the bottom button's text to black but the date picker looked awkward with the white colour in bottom bar. That is why prefer to change the whole bottom bar colour to black.
Upvotes: 2
Views: 1900
Reputation: 17340
Figured out the solution, pasting it below:
<style name="DatePickerTheme_Dark" parent="Theme.AppCompat.Dialog">
<item name="colorAccent">@color/highlight_color_blue</item>
<item name="android:datePickerStyle">@style/MyDatePickerStyleDark</item>
<item name="android:windowBackground">@color/background_color_black</item>
</style>
<style name="MyDatePickerStyleDark" parent="@android:style/Widget.Material.DatePicker">
<item name="android:headerBackground">@color/highlight_color_blue</item>
</style>
and the result
Upvotes: 5