ios - 将 ImageBackground 调整为全屏
问题描述
我给了一个 ImageBackground 组件,我希望它占据整个屏幕,但即使我调整图像大小两倍或更多,它似乎也有小填充。它来自哪里?
Here is the code of the component
import React from "react";
import { View, Text, Button, ImageBackground, StyleSheet } from "react-
native";
export class HomeScreen extends React.Component {
static navigationOptions = {
//To hide the NavigationBar from current Screen
header: null
};
render() {
return (
<ImageBackground source={require('../imgs/bgx.png')} style={
styles.container }>
</ImageBackground>
);
}
}
var styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'stretch',
resizeMode: 'stretch'
}
});
解决方案
添加width='100%'
和height='100%'
推荐阅读
- mongodb - 为什么在 github、dockerhub 或 mongodb compass 中删除之前要求输入存储库名称或数据库名称
- powershell - 在 Azure 上的应用服务中导入模块不起作用
- django - Django:'HttpResponseRedirect(reverse())' 重定向到同一页面
- javascript - 验证函数后javascript丢失变量值
- sql - 停止“关闭 JPA EntityManagerFactory 关闭”
- angular - ngx-translate 如何隔离翻译服务
- android - android:使用 context.getExternalFilesDir 时 EACCS 权限被拒绝
- regex - 正则表达式擦除除数字有限的所有数字
- wordpress - 更改 PayPal Express Checkout 插件中的 paypal 项目名称
- ios - Tizen Watch 和 iOS 连接问题