Android:字体下载及字体替换

字体下载链接

mirrors / Ice-Times / Android-ttf-download · GitCode

下载好后里面有十几种字体

 字体的使用

官方文档里面有介绍

https://developer.android.com/guide/topics/resources/font-resource?hl=zh-cn

我简单概括一下

在res目录里面新建一个font文件夹,将需要的字体考入这个文件夹,根据需要重新命名

新建一个lobster文件

内容如下:

<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:android="http://schemas.android.com/apk/res/android">
    <font
        android:fontStyle="normal"
        android:fontWeight="400"
        android:font="@font/pop" />
    <font
        android:fontStyle="italic"
        android:fontWeight="400"
        android:font="@font/pop" />
</font-family>

使用

        <TextView
            android:fontFamily="@font/lobster"
            ....
        />

实现效果

 

猜你喜欢

转载自blog.csdn.net/title71/article/details/129884568