Change font of DatePickerDialog Calendar

53 Views Asked by At

I want to set Roboto font across the app instead of using the device's system font.

In our project, we are still using android.app.DatePickerDialog. To change the font, I added a custom style on the instance of DatePickerDialog but only the font of the header is being changed.

Is it possible to change the font of the calendar view of DatePickerDialog?

datepickerdialog calendar

DatePickerDialog

val c = Calendar.getInstance()

DatePickerDialog(
            requireContext(),
            R.style.DatePickerDialogTheme,
            dateListener,
            c.get(Calendar.YEAR),
            c.get(Calendar.MONTH),
            c.get(Calendar.DAY_OF_MONTH)
        )

Custom Style

<style name="DatePickerDialogTheme" parent="ThemeOverlay.MaterialComponents.MaterialCalendar">
        <item name="colorAccent">@color/colorAccent</item>
        <item name="fontFamily">@font/roboto</item>
        <item name="android:fontFamily">@font/roboto</item>
</style>
0

There are 0 best solutions below