【发布时间】:2021-02-23 07:17:52
【问题描述】:
由于某种原因,我无法使用 react native 在 android 中正确对齐文本。我的代码在 iOS 上运行良好,但在 android 上没有。有人知道原因或解决方法吗?
布局
<View style={styles.viewOC}>
<Text style={styles.leftText}> Left</Text>
<Text style={styles.rightText}> Right</Text>
</View>
样式
...
viewOC: {
paddingTop: 8,
flexDirection: "row",
justifyContent: "space-between",
width: "100%",
textAlignVertical: "center",
alignSelf:"stretch",
},
leftText: {
textAlign: "left",
fontSize: 12,
justifyContent: "center",
textAlignVertical: "center",
justifyContent: "flex-start",
alignSelf: "flex-start",
},
rightText: {
textAlign: "right",
fontSize: 12,
maxWidth: "50%",
textAlignVertical: "top",
justifyContent: "flex-end",
alignSelf: "flex-end",
}...
【问题讨论】:
标签: android react-native