14
如何在Android中为整个应用程序设置自定义字体?
是否可以在Android应用程序中设置自定义字体? 我尝试过这里发布的内容,但是我不知道我在哪里extends Application课程... 有什么帮助吗? 编辑: 我尝试了以下方法: 添加资产文件夹并在其中插入字体,如下所示: 添加一个从 Application 从我的学校叫这个新班AndroidManifest.xml。 我按照自己的风格进行了添加。 MyApp.java: public class MyApp extends Application { @Override public void onCreate() { super.onCreate(); FontsOverride.setDefaultFont(this, "DEFAULT", "raleway_regular.ttf"); // This FontsOverride comes from the example I posted above } } AndroidManifest.xml: <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:name=".MyApp" android:theme="@style/AppTheme"> .... styles.xml: <style …