我有一些看起来像这样的React Native代码:
<View style={{flex: 1, flexDirection: 'row', justifyContent: 'space-between'}}>
<View style={{width: 50, height: 50, backgroundColor: 'powderblue'}} />
<View style={{width: 50, height: 50, backgroundColor: 'skyblue'}} />
<View style={{width: 50, height: 50, backgroundColor: 'steelblue'}} />
</View>
<View style={{flex: 1, flexDirection: 'row', justifyContent: 'center'}}>
<View style={{width: 50, height: 50, backgroundColor: 'powderblue'}} />
<View style={{width: 50, height: 50, backgroundColor: 'skyblue'}} />
<View style={{width: 50, height: 50, backgroundColor: 'steelblue'}} />
</View>
但两个视图看起来一样,如下图所示:
即使上述justifyContent
设置为space-between
,它也会显示为center
。