Google published the official font resources handling since support library v26 released: https://developer.android.com/guide/topics/ui/look-and-feel/fonts-in-xml.html
However, looks like I cannot add country qualifier for the font resources folder.
I have an app which has 3 languages: English, Traditional Chinese and Simplified Chinese.
And I tried to name my font folder under res
this way:
font
font-zh
font-zh_CN
(I have also tried font-zh-CN
)
(Note that zh
is the language, while CN
is the country. With some more context for your information - In China we all use "Chinese", but there are Simplified Chinese and Traditional Chinese; Moreover, Hong Kong and Taiwan both use Traditional Chinese but the way we use them are a bit different. Most importantly, typefaces have separate files for Traditional Chinese and Simplified Chinese, due to the fact that they are quite different in their shapes.)
But I cannot build the project. Android Studio keeps telling me that font-zh_CN
(or font-zh-CN
) is an invalid resource directory name.
This does not happen for my values-zh_CN
folder (nor values-zh-CN
).
Question:
How do you use different fonts for the same language but different country, using the new official method since API 26?