[英]How to change font family of Android Date Picker?
我想更改 android 日期选择器的字体系列
<DatePicker
android:id="@+id/dob_picker"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:calendarViewShown="false"
android:datePickerMode="spinner" />
创建一个主题,例如
<style name="PickerTheme">
<!-- Customize your theme here. -->
<item name="android:fontFamily">@font/open_sans</item>
</style>
然后
<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" />
对于 2022 年仍面临问题的任何人,请先创建主题:
<style name="PickerTheme">
<!-- Customize your theme here. -->
<item name="android:fontFamily">@font/open_sans</item>
</style>
并将此行添加到布局:
app:theme="@style/PickerTheme"
而不是android:theme
所以试试这个对我有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.