【发布时间】:2016-08-07 00:29:30
【问题描述】:
是否可以更改 android 库项目中使用的组件的字体?
更具体地说:我在第一次启动应用程序时使用库“Onboarder”来显示介绍。现在我需要在任何显示文本的地方使用某种字体。通过 'Caligraphy' 库,我能够在其他任何地方引入新字体。
我已经在我自己的布局文件中定义了适用于 TextViews 的样式:
<style name="TextViewStyle" parent="android:Widget.TextView">
<item name="fontPath">fonts/myCustomFont.ttf</item>
</style>
应用主题:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
[...]
<item name="android:textViewStyle">@style/TextViewStyle</item>
[...]
</style>
库项目也使用纯 TextView 没有任何样式,但不知何故我的样式没有应用于它们。
有没有办法在不分叉 GitHub 存储库的情况下更改这些 TextView 上的字体?
这可能是相关的:How to override styles of a library which has its own Activity
提前感谢您的帮助。
【问题讨论】:
标签: android android-theme android-styles android-library