4

If I check here https://fonts.google.com/specimen/Poppins I can find that it exists in the description.

Example

But after checking font importer from android studio that type is not there

Android Studio Example

And I tried to create it using the weight I see a warning in android studio and the font does not seems right:

enter image description here

---EDIT

Now it shows me this

enter image description here

Is it possible to use that or there's no other possibility than downloading the font file and have them locally?

Daniel Gomez Rico
  • 15,026
  • 20
  • 92
  • 162
  • You're right there is this warning. Did you try with latest version 3.6.1 or with the as 4.0 beta 1 or as 4.1 canary 2? And did you test if the font is actually the right one besides the warning? – Vall0n Mar 11 '20 at 10:07
  • In as 3.6.1 the waring is still there and it seems that it is falling back to the font with the weight at 700 – Vall0n Mar 11 '20 at 10:27
  • Did you find any solution to this ? I am running into same issue – B.shruti Jul 17 '20 at 05:41

3 Answers3

1

You could probably download those ttf files from the Google fonts and then put them in assets folder and then u could directly access them using setTypeface dynamically. Use it in Utils class which makes u to reuse across all the Activities. this is the best approach

pramod_m
  • 184
  • 1
  • 9
  • But I want to use downloadable fonts, otherwise I will end up using just the maximum bolder font in there. – Daniel Gomez Rico Mar 11 '20 at 23:36
  • 1
    You could use the FontRequest and download it and use if if you need so @DanielGomezRico - refer https://developer.android.com/guide/topics/ui/look-and-feel/downloadable-fonts – pramod_m Mar 30 '20 at 12:39
0

You need not to change anything with your poppins_extrabold.xml but what you need to do is use any Textview in your layout xml and add

android:fontFamily="@font/poppins_extrabold"

0

Below are the steps to achieve the same-

  1. Add a new folder assets in the app/src/main directory and add a sub-folder fonts

  2. Add your poppins_bold.ttf file under fonts directory, you just created.

  3. Add below lines in your Activity file -

    Typeface font = Typeface.createFromAsset(getAssets(),"fonts/poppins_bold.ttf"); yourTextView.setTypeface(font);

B.shruti
  • 1,589
  • 1
  • 21
  • 41