android - 文本输入中的字体系列 React native

标签 android react-native

我正在尝试实现文本输入,其中字体系列是 Zila Slab Bold,但字体系列仅适用于文本输入的占位符,它不适用于输入的文本,而是显示默认的 android 文本,但是当我使用 Zila Slab Medium 时,它适用于占位符和输入文本,请问我做错了什么,我使用的是 RN 0.55.0

这就是我想要得到的

enter image description here

这是我使用 Zila Bold 时得到的结果

enter image description here

这是我下面的代码

<TextInput    
       underlineColorAndroid={'transparent'}
       placeholder="The Title"
                  placeholderStyle={{fontFamily: 'ZillaSlab-Bold',
            fontSize: 16,}}
                  placeholderTextColor="rgba(0, 0, 0, 0.2)"
style={{
                      paddingLeft: 28,
                      width: (Dimensions.get('window').width),
                      backgroundColor: 'transparent',
                      fontSize: 16, color: 'black',
                      borderTopWidth: 2, borderBottomWidth: 2, borderColor: 'black', 
            marginTop: 100, flexDirection: 'row', alignItems: 'center', fontFamily: 'ZillaSlab-Bold',
                  }}/>   

最佳答案

Люда Дзюбинска 提出的解决方案对我不起作用,但类似的方法可以解决问题 - 我指定了 fontWeight: 'normal' TextInput 的样式字段(即使我有一个半粗体字体),它让我避免在输入时重置字体系列。

关于android - 文本输入中的字体系列 React native,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55540553/

相关文章:

android - 在 Android 上使用 Google map 的简单跟踪应用程序

java - EditText leftView 图片适合Android EditText的大小

Android 设备、ionic 应用程序和 $cookies

android - 如何在android中禁用复制粘贴

react-native - React Native 中 DatePickerIOS 的 Prop 问题

image - 当图像(来自react-native)抛出 onError 时渲染文本组件

java - 无法使用我的设备运行我的应用程序

react-native - 如何在 React Native 的动画结束时调用函数

javascript - 当使用 Redux (React Native) 提供数据时,平面列表不会更新

react-native - 我有 firebase.messaging.requestPermission() 问题,无论我选择 'allow' 还是 'Not Allow',总是会导致异常