Cai*_*ira 5 android styles react-native 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时,它看起来像这样:

我究竟做错了什么?
小智 0
您的图像已被缓存,重命名静态文件或将查询字符串添加到动态文件:
source={require('../../assets/images/background_new.png')}
source={{uri: "link/image.jpg?v=1.1" }}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
824 次 |
| 最近记录: |