我有我自己的字體,我想用於我的應用程序的所有佈局,我想更改我的應用程序的默認字體。Android Studio自定義字體爲stadard /默認字體?
在styles.xml我可以使用
<item name="android:fontFamily"></item>
改變更改字體,但我怎麼在這裏用我的自定義字體?
在應用程序 - > SRC - >主,我做了所謂的資產一個新的目錄,然後又目錄中的一個叫字體,而這正是我把我的自定義字體。
這可能嗎?如果是這樣,怎麼樣?
EDIT
正如mayosk說,我添加
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
並取得Java類延伸的應用如下所示
public class CustomResources extends Application {
@Override
public void onCreate() {
super.onCreate();
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
.setDefaultFontPath("fonts/din_light.ttf")
.setFontAttrId(R.attr.fontPath)
.build()
);
}
}
但字體仍然是相同的,我錯過了什麼
這可能有助於[http://stackoverflow.com/a/29134056/7676637] – AwaisMajeed
可能重複的:http://stackoverflow.com/questions/2711858/is-它-可能-TO-設置一個自定義字體爲整個應用程序 –