I am trying to set a font to a text view in android studio but for some reasons, I cannot access the font directory.
I get Unresolved Reference: font
What I did
- Created a new directory by right clicking res > new > Android Resource Directory > Directory name : font > Resource type : font
- Placed my font in that directory, so the directory reads - res/font/myfont.ttf
- In my fragment I tried to access the font like this
var typeFace: Typeface? = ResourcesCompat.getFont(requireContext(), R.font.myfont.ttf)
Error shows Unresolved Reference: font
I tried to rebuild project but still not working.