【发布时间】:2018-10-18 12:58:18
【问题描述】:
我正在尝试显示一个宽度根据高度调整的图像,我为此目的使用了 resizeMode="contain" 但它显示了图像前后的空间。我尝试设置边距、填充、左、右,但它们都不起作用。
<View style={{ flex: 1 }}>
<ScrollView horizontal>
<View style={{ borderColor: "#f00", borderWidth: 2, height: 300 }}>
<Image source={images[0].uri} resizeMode="contain" style={{ height: 300, width: 300 }} />
</View>
<View style={{ borderColor: "#f00", borderWidth: 2, height: 300 }}>
<Image source={images[1].uri} resizeMode="contain" style={{ height: 300 }} />
</View>
</ScrollView>
</View>
【问题讨论】:
标签: image reactjs react-native height width