reactjs - React Native 尝试为文本创建边框
问题描述
我正在尝试为文本创建一个“框”——这意味着一个带有文本边框和背景颜色的边界框(在我的例子中是单个字符)。
但是当我创建一个视图和文本时,文本被视图的上限剪切(看看A是如何被剪切的),我不明白为什么。
我现在的情况
<View style={styles.container}>
<Text style={styles.letter} > {character} </Text>
</View >
export default EStyleSheet.create({
container: {
justifyContent: 'center',
alignItems: 'center',
},
letter: {
fontSize: 30,
backgroundColor: 'powderblue',
borderWidth: 2,
textAlign: 'center',
borderColor: 'steelblue',
},
});
谢谢您的帮助。
解决方案
尝试将margin
样式添加到letter
and aligSelf: 'center'
,但实际上我建议将backgroundColor
and添加borderWidth
到<View>
样式
推荐阅读
- c++ - 将int数组转为矩阵类完成算子重载的问题
- r - 错误:美学必须是长度 1 或与数据相同 (9):标签
- c# - 使 ProcessCmdKey 异步等待 - C#
- javascript - 从另一个数组内的数组中获取所有值
- linux - 使用 jumpserver 选项通过 ssh 使用 sshpass 登录
- performance - Levenshtein 距离算法的性能是否优于 Needleman Wunsch 算法?
- ios - 无法在小部件扩展部署目标上选择 iOS 14.0
- c# - 即使我们动态更改 URL,WSDL 是否需要始终处于活动状态
- html - BOX并排放置
- python-3.x - 如何在发布请求键中传递变量?