首页 > 解决方案 > Android上的ImageBackground重复没有填满屏幕

问题描述

我正在使用 react native 构建一个应用程序,我想用这样的重复调整大小模式来实现背景图像

        <View 
            style   = {style.container}>
            <ImageBackground 
                source={require('../../assets/images/background.png')}
                resizeMode="repeat"
                style={style.imageBackground}
                >
                    ...
            </ImageBackground>
        </View>

款式:

imageBackground: {
    width: '100%', 
    height: '100%', 
    resizeMode: 'repeat',
    justifyContent:'center'
},
container: {
    marginTop: Platform.OS === 'ios' ? 0 : StatusBar.currentHeight + 30,
    flex: 1,
    backgroundColor: COLORS.BACKGROUND,
    justifyContent: 'center',
},

在 iOS 上它可以完美运行。但是当我打开 Android 时,它看起来像这样:

我究竟做错了什么?

标签: androidreact-nativestylesimagebackground

解决方案


推荐阅读