如何在运行时使用本地化字体



我有3个本地化文件xml:app_font_xmlapp_font_xml (it)app_font_xml(zh)

app_font_xml:(其他相同,但使用不同的android:font(

<?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/en_font" />
<font
android:fontStyle="italic"
android:fontWeight="400"
android:font="@font/en_font" />
</font-family>

当我在手机设置中更改语言时,字体不会更新。

我必须终止并重新启动应用程序才能获得新字体。

我希望在运行时使用新字体。

您应该本地化"res/style";而不是";res/font";文件夹

最新更新