Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
276 views
in Technique[技术] by (71.8m points)

android - Using font in XML in API < 26

https://developer.android.com/preview/features/working-with-fonts.html

Android API 26 supports this but do we have a support library that can provide use of fonts as a resource in res? [ font in XML ] If yes, up-to what API is it supported?

I am talking about the Android O SDK feature which allows us to set font in XML as given in the link above. This is not a native feature in MM I m sure.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

To support font family on API lower than 26, we need to use

<font app:fontStyle="normal" app:fontWeight="400" app:font="@font/myfont-Regular"/>

instead of

<font android:fontStyle="normal" android:fontWeight="400" android:font="@font/myfont-Regular"/>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...