I have a date picker dialog that I use in spinner
mode. This is the theme used by the date picker dialog.
<style name="CustomDatePickerDialogTheme" parent="android:Theme.Material.Light.Dialog">
<item name="android:datePickerStyle">@style/MyDatePickerStyle</item>
</style>
<style name="MyDatePickerStyle" parent="@android:style/Widget.Material.DatePicker">
<item name="android:datePickerMode">spinner</item>
This works fine when I use it when "Dark Mode = off". But it does not reverse the colors when "Dark Mode = on". Irrespective of the Dark Mode this is how the dialog looks like
I tried changing the parent theme to Theme.AppCompat.DayNight.Dialog
. Now the dialog looks like this when "Dark Mode = on"
How do I make the DatePickeDialog (in spinner mode) compatible with Dark Mode?
Please try without specifying the parent theme, this works for me. but your dialog will be full screen for this in your theme add android: windowIsFloating = true
. this to center the dialog on the screen and it becomes like a normal Dialog
this is my theme :
<style name="CustomDatePickerDialogTheme">
<item name="android:datePickerStyle">@style/MyDatePickerStyle</item>
<item name="android:windowIsFloating">true</item>
</style>
<style name="MyDatePickerStyle" parent="@android:style/Widget.Material.DatePicker" tools:targetApi="lollipop">
<item name="android:datePickerMode">spinner</item>
</style>