我需要为我的整个应用程序使用某些字体.我有相同的.ttf文件.是否可以在应用程序启动时将其设置为默认字体,然后在应用程序的其他位置使用它?设置后,如何在布局XML中使用它?
我在我的应用程序中使用Roboto light字体.要设置字体,我要添加android:fontFamily="sans-serif-light"到每个视图.有没有办法将Roboto字体声明为整个应用程序的默认字体系列?我尝试过这样但它似乎没有用.
<style name="AppBaseTheme" parent="android:Theme.Light"></style>
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:fontFamily">sans-serif-light</item>
</style>
Run Code Online (Sandbox Code Playgroud)