小编Cai*_*ira的帖子

Android 上的 ImageBackground 重复未填满屏幕

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

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

款式:

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',
},
Run Code Online (Sandbox Code Playgroud)

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

我究竟做错了什么?

android styles react-native imagebackground

5
推荐指数
1
解决办法
824
查看次数

标签 统计

android ×1

imagebackground ×1

react-native ×1

styles ×1