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" />
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" />
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.