如何在 React Native android 中添加自定义字体 [英] How to add custom font in react native android
本文介绍了如何在 React Native android 中添加自定义字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将 fontFamily
设置为比我的工具栏标题更薄的机器人.
I want to set fontFamily
to roboto thin of my toolbar title.
我在我的 android 项目的 assets/fonts
文件夹中添加了 Roboto Thin ttf,但是它似乎在运行应用程序时产生了问题.我在运行时遇到这个问题
I have added roboto thin ttf in assets/fonts
folder of my android project, however it seems that it is creating issues while running app. I am getting this issue while running
react-native 启动
react-native start
ERROR EPERM: operation not permitted, lstat 'E:Myntraandroidappuildgener
atedsource
debugandroidsupportv7appcompat'
{"errno":-4048,"code":"EPERM","syscall":"lstat","path":"E:\Myntra\android\app
\build\generated\source\r\debug\android\support\v7\appcompat"}
Error: EPERM: operation not permitted, lstat 'E:Myntraandroidappuildgenera
tedsource
debugandroidsupportv7appcompat'
at Error (native)
当我删除字体时,它工作正常.我无法解决这个问题.什么原因?
When I am removing the font then it is working fine. I am unable to fix this issue. What's the reason?
推荐答案
将您的字体文件添加到
Add your fonts file in
项目文件夹/android/app/src/main/assets/fonts/font_name.ttf
fontFamily: 'font_name'
在此处查看更多示例自定义字体示例
这篇关于如何在 React Native android 中添加自定义字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文