androidxmlfonts

Font not uploading correctly to android studio


I have started a new project in android studio, and it's my first time adding a font, I tried following this android studio guide and used this font from Google Fonts.

I created the resource file named font under res, while double checking the Resource type is font. I added the ttf files from the unzipped folder I downloaded from Google Fonts to the font folder, and created an xml named Ubuntu.xml.

However the ttf files are showing with an error underline and are red in the file Ubuntu.xml

This is how the files are showing

And this is the xml file

I tried playing with it a bit, and tried looking for the answer but I really have no clue what the problem is.


Solution

  • Rename the fonts. Change the character - to _. And make it all lower case

    For example:

    ubunto_bold.ttf