I have a TextView that I want to style. I know that sans-serif font family uses the font Roboto.
<TextView
android:fontFamily="serif"/>
I only get the following suggestions for fontFamily
:
How do you use the rest of the aliases declared in /system/etc/font.xml ?
<familyset version="22">
...
<!-- Note that aliases must come after the fonts they reference. -->
<alias name="sans-serif-thin" to="sans-serif" weight="100" />
<alias name="sans-serif-light" to="sans-serif" weight="300" />
<alias name="sans-serif-medium" to="sans-serif" weight="500" />
<alias name="sans-serif-black" to="sans-serif" weight="900" />
<alias name="arial" to="sans-serif" />
<alias name="helvetica" to="sans-serif" />
<alias name="tahoma" to="sans-serif" />
<alias name="verdana" to="sans-serif" />
...
</familyset>
Turns out, alias
tags are not being "scanned" by Android Studio so they appear in suggestions dropdown. Doing like so is okay:
<TextView
android:fontFamily="sans-serif-black"/>
Cheers!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.