【问题标题】:How to separate 2 images in react native如何在本机反应中分离2个图像
【发布时间】:2019-03-20 06:08:59
【问题描述】:

在我的应用程序中,我在 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>

【问题讨论】:

  • 我的回答对您的问题有帮助吗?

标签: react-native


【解决方案1】:

为每个图像添加边距并相应地调整图像大小。如果您不想在图像的每一侧都设置额外的边距,请提供第一个图像 marginRight 和第二个图像 marginLeft。

【讨论】:

    猜你喜欢
    • 2021-05-24
    • 1970-01-01
    • 2020-08-18
    • 2018-09-29
    • 2019-03-31
    • 1970-01-01
    • 2021-06-15
    • 2019-12-07
    • 1970-01-01
    相关资源
    最近更新 更多