如何在React Native中分离2张图片

时间:2019-03-20 06:09:00

标签: react-native

在我的应用程序中,我在scrollView中并排添加了2个图像,但是它们彼此结合在一起,所以我希望它们之间可以有空格。

here is the image of how it looks

代码如下:

<View style={{ height: 230, marginTop: 20, justifyContent:'space-around' }}>
    <ScrollView horizontal={true} showsHorizontalScrollIndicator={false} >  
        <Image  source={require('../assets/images/restaurant.jpg')} />
        <Image  source={require('../assets/images/experiences.jpg')} />
    </ScrollView>
</View>

1 个答案:

答案 0 :(得分:0)

为每张图像添加边距并相应地调整图像大小。如果您不希望在图像的每个侧面都留有多余的边距,请提供第一个图像marginRight和第二个图像marginLeft。