Android DatePicker 字体 [英] Android DatePicker Typeface

查看:21
本文介绍了Android DatePicker 字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道您可以像这样将自定义 TypeFace 应用到 Android 中的 TextView:

I am aware you can apply a custom TypeFace to a TextView in Android like this:

TextView tv = findViewById(R.id.textview01);
Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/BLACKROSE.TTF");
tv.setTypeface(tf);

有没有办法为 DatePicker 做到这一点?

Is there any way possible to do this for a DatePicker?

推荐答案

在查看源代码后,Datepicker 小部件包含 3 个 NumberPicker 小部件(用于日、月、年),这些小部件又包含一个 TextView.因此,您必须在 DatePicker 内的 NumberPickers 内为 TextView 设置字体.

After taking a look at the source, the Datepicker widget holds 3 NumberPicker widgets (for day, month, year)which in turn hold a TextView. So you are going have to set the Typeface for the TextView inside the NumberPickers inside the DatePicker.

我认为您必须获得 NumberPicker 和 DatePicker 的源代码并修改源代码才能实现这一点,恐怕说起来容易做起来难.

I think you'll have to get the source for both NumberPicker and DatePicker and modify the source to achieve this, easier said than done I'm afraid.

这篇关于Android DatePicker 字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆