2

I want to change the font family of the android date picker

<DatePicker
            android:id="@+id/dob_picker"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:calendarViewShown="false"
            android:datePickerMode="spinner" />

2 Answers 2

1

create a theme, ex

    <style name="PickerTheme">
        <!-- Customize your theme here. -->
        <item name="android:fontFamily">@font/open_sans</item>
    </style>

then

<DatePicker
        android:id="@+id/dob_picker"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:calendarViewShown="false"
        android:theme="@style/PickerTheme"
        android:datePickerMode="spinner" />
1
  • that's weird, because it's work on my end, did you use a right font?
    – GianhTran
    Commented Mar 18, 2020 at 7:38
0

For anyone still facing issue in 2022, create theme first:

  <style name="PickerTheme">
        <!-- Customize your theme here. -->
        <item name="android:fontFamily">@font/open_sans</item>
    </style>

and add this line to layout:

        app:theme="@style/PickerTheme"

Instead of android:theme so try this this worked for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.