If you didn't change any styles, my best guess is it has something to do with the way Kotlin is deriving the context in this line:
return DatePickerDialog(requireContext(), this, year, month, dayOfMonth)
For Java you would call the DatePickerDialog as such:
return new DatePickerDialog(getActivity(), this, year, month, day);
android docs reference
I'm no expert on Kotlin, but a Java to Kotlin converter I used here returned the Kotlin as this line:
return DatePickerDialog(getActivity(), this, year, month, day)
The normal DatePickerDialog doesn't display the 'ok' and 'cancel' buttons with the default button background color. It displays a white background and sets the button text to that default color.
I think your code is somehow deriving the context of your button styles from the parent activity or default of your app, which would match the background color of the buttons to the main style instead of the date picker's normal overwrite to a white background.
My best guess is because you are using the new requireContext()
and requireActivity()
methods here; however, why are you using context instead of activity? Try requireActivity()
instead:
return DatePickerDialog(requireActivity(), this, year, month, dayOfMonth)
After trying this line and/or getActivity()
as shown above, please update.