I am using Android Studio and I have the following code:
Typeface customTypeface = Typeface.createFromAsset(getAssets(), "micra.ttf");
Which executes perfectly when my .ttf
file is under the assets folder. But when I make a folder assets/fonts
, move the .ttf
file to that folder and try the following code:
Typeface customTypeface = Typeface.createFromAsset(getAssets(), "fonts/micra.ttf");
The application crashes.
What is the problem here? Should I replace the /
symbol with something else? My assets folder is under app/src/main.
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.