【发布时间】:2021-11-26 11:24:06
【问题描述】:
我的包装视图和文本输入之间出现了一些差距,我检查了填充和边距,但没有任何效果:
<View style={styles.wrapper}>
<View style={{ width: '100%',height:'10%', backgroundColor: 'yellow' }}></View>
<TextInput style={styles.edit_input}
numberOfLines={15}
multiline={true}
/>
</View>
造型:
wrapper: {
width: '90%',
marginTop: '10%',
backgroundColor: 'gray',
borderTopWidth: 1,
},
edit_input: {
backgroundColor:'white',
color: 'black',
borderWidth: 1,
textAlignVertical: 'top',
width: '90%',
alignSelf: 'center',
},
但是当您将 height:'10%' 替换为 height:50 时,这种情况就会消失
知道是什么原因造成的吗?或者如何使用相对单位解决这个问题?
【问题讨论】:
-
高度不受影响
-
@Ifaruki 是什么意思?
标签: javascript android react-native