可以在 android styles xml 中指定 fontType 吗?

发布于 2024-09-11 18:36:27 字数 140 浏览 5 评论 0原文

我正在遵循 Jeff Sharkey 的示例项目“Sky”,在布局中使用样式。它运行得很好,但是,我无法确定如何使用样式指定字体。如果没有这个,我将不得不显式地将字体应用到每个 TextView、EditView 等,而我想控制在整个应用程序中应用字体的位置和时间。

I am following an example project "Sky" by Jeff Sharkey using styles in my layout. It is working out quite well, however, I cannot determine how to specify the font type-face using the styles. Without this, I will have to apply the font explicitly to every TextView, EditView, etc., whereas I want to control where and when it is applied throughout my application.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

薔薇婲 2024-09-18 18:36:27

看来从xml/styles中是不可能的...只能从java代码中指定它。
如果您感兴趣,请查看此处

It seems that it is not possible from xml/styles... You can only specify it from java code.
check here if you are interesting.

情仇皆在手 2024-09-18 18:36:27

您可以通过创建自己的 textview 类并在布局中使用它来做到这一点。

在新的自定义类中,设置所需的字体。

等等瞧!

You can do this by creating your own textview class and use that in your layouts.

Inside your new custom class, set the font you want.

Et voila!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文