react-native - android 中的文本降低和截断,但 ios 没有 - 反应原生
问题描述
文字应该看起来像这样 IOS
但在 Android 上它看起来像这样: Android
文本和容器样式的代码是:
text: {
fontFamily: 'Roboto',
fontSize: 40,
width: 250,
height: 40,
textAlignVertical: 'center',
textAlign: 'center',
},
container: {
backgroundColor: '#DDDDDD',
width: 250,
height: 55,
margin: 12.5,
borderRadius: 10,
justifyContent: 'center'
}
和组件:
<TouchableOpacity
style={styles.container}
onPress={_ => this.navigation.push('Join')} >
<Text style={styles.text}>Join</Text>
</TouchableOpacity>
<TouchableOpacity
style={styles.container}
onPress={_ => this.navigation.push('Create')} >
<Text style={styles.text}>Create</Text>
</TouchableOpacity>
解决方案
用这个替换你styles
的:
text: {
fontFamily: 'Roboto',
fontSize: 40,
textAlignVertical: 'center',
textAlign: 'center',
},
container: {
backgroundColor: '#DDDDDD',
margin: 12.5,
borderRadius: 10,
justifyContent: 'center',
alignSelf: 'center',
width: 250,
},
推荐阅读
- r - 在 dplyr 和 sparklyr 中动态类型转换为数字
- python - 从 column1 动态获取值并将其分配给同一列中的 NaN 值,如果它们都具有相同的 column2 值
- apache-kafka - Kafka内部数据管理
- javascript - 如果不需要任何道具,我应该用 React.memo() 包装我的所有组件吗?
- azure - 尝试在 Linux 上使用 Maven 和 Azure 将 Spring Boot JAR 文件应用程序部署到 Azure 应用程序服务
- json - 尝试 Web 请求时出现用户错误
- android - android kotlin retrofit2 分段文件上传成功但文件已损坏
- c# - 根事务范围不回滚嵌套事务范围
- python - 如何在 python 中自动计算 SQLalchemy 表中的字段?
- mysql - 在 MySQL Workbench 中执行触发代码时出错