可以在 android styles xml 中指定 fontType 吗?
我正在遵循 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看来从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.
您可以通过创建自己的 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!