In my Android app i set the style of my TextView like this:
<TextView
android:fontFamily="cursive"
android:textStyle="normal|bold"
...
/>
For example in Lollipop will work because there is the cursive font by default: see here
Now I'd like to know in which version there isn't the cursive font.
p.s.
cursive font=DancingScript-Regular.ttf
It's weird. The cursive
font family is officially available starting at API level 16 (Jellybean). However, it uses the DroidSerif
font which is not a cursive looking font. By API 21, they move to the DancingScript
font which looks far more cursive like.
So, you may be able to use the keyword in API 16-20, but it won't amount to much. From API levels 21+, it should look very much like cursive script.
You can look at the available fonts if you go here:
{ANDROID-SDK-HOME}/platforms/android-{SDK-INT}/data/fonts
The containing system-fonts.xml
has all them listed with the corresponding fonts.
Actually cursive
font family shouldn't be available form android device. Over here you can find perfect explanation what you can set using fontFamily
and textStyle
.
If you want to use custom fonts I strongly recommend Calligraphy lib.
来源:https://stackoverflow.com/questions/40588559/in-which-android-version-the-cursive-font-is-available