简体   繁体   中英

How to use new Google's Sans font in my Android App?

How can I use the font seen in fresh Google's apps like Phone, Contact and Google Fit in my Android App? Is there some new textAppearance value for this? Here's the preview of desired font (titles): 谷歌的新材料字体

As I could find out, this font is called something like "Google Sans".

Thanks.

I too wondered here and there to know how to use that font. I came to know that you cannot use it legally and for official use but if you have personal use then you can use this answer.
I am adding this answer only to answer your question but not to allow everyone to use that font!!

Here are the steps:

  • Download the font zip file by checking out my blog post

  • Make directory named font under res folder and add the TTF files under it.

  • Now add the font to the TextView using this attribute:

android:fontFamily="@font/google_sans"

I am sure that this will work for all devices.
But again I tell you, don't use it for professional work!!

I've also was wondering how to use it, for personal use though. Oddly enough I used this and it works perfectly fine, though I own a pixel device and am pretty sure this won't work on other devices. Here's what I used for the TextView:

    android:textAppearance="@android:style/TextAppearance.DeviceDefault.Widget.Button"

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM