user1506104
user1506104

Reputation: 7086

How do you use Android's default font (Roboto) families?

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>

Upvotes: 0

Views: 168

Answers (1)

user1506104
user1506104

Reputation: 7086

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!

Upvotes: 0

Related Questions