android如何實現加載本地字體

   我們在做項目的時候,大部分都會遇到這個需求,如何更改APP的字體,使用我們自己規定的字體,來實現更好的APP的體驗,以及展示效果。下面我就分享一下,目前我用到的方法。

 

1:在res目錄下面 創建 font 字體文件夾,並把我們要用的字體方進去。

 

2:在Style文件下配置字體

 

3:運用

 

<TextView
    style="@style/Medium_TextView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerVertical="true"
    android:layout_marginLeft="15dp"
    android:text="xiebin"
    android:textColor="#232323"
    android:textSize="15sp" />

 

這就是我目前項目中,更改字體的方法,還是蠻簡單的。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章