[英]Set default font family for Android app
I'm new to Android studio and I am wondering where to set the default font family for Android app in Android studio after reading the accepted answer here . 我是Android Studio的新手,在阅读了此处接受的答案后,我想知道在Android Studio中为Android应用程序设置默认字体系列的位置。
I have tried to put the code in activity_main.xml
and AndroidManifest.xml
but it does not work. 我试图将代码放在activity_main.xml
和AndroidManifest.xml
但是它不起作用。
Any help would be appreciated! 任何帮助,将不胜感激!
Thanks KDeogharkar! 感谢KDeogharkar!
Looks like I would have to add the code inside of styles.xml
in values
folder. 看起来我将不得不在values
文件夹中的styles.xml
内部添加代码。 It worked :) 有效 :)
/res/values*/themes.xml /res/values*/themes.xml
Pick any parent theme to extend here 选择任何父主题以在此处扩展
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:textViewStyle">@style/RobotoFont</item>
</style>
<style name="RobotoFont" parent="android:Widget.TextView">
<item name="android:fontFamily">sans-serif</item>
</style>
</resources>
Then in your app manifest 然后在您的应用清单中
android:theme="@style/AppTheme`"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.