Javascript 反应本机,在android上使用全屏图像
我刚开始开发一个新的应用程序,马上遇到了一个问题 在这里,右边是ios,背景成功地覆盖了整个屏幕,包括顶部栏和底部导航。然而,在android上,这并没有发生 这是我的密码:Javascript 反应本机,在android上使用全屏图像,javascript,android,ios,reactjs,react-native,Javascript,Android,Ios,Reactjs,React Native,我刚开始开发一个新的应用程序,马上遇到了一个问题 在这里,右边是ios,背景成功地覆盖了整个屏幕,包括顶部栏和底部导航。然而,在android上,这并没有发生 这是我的密码: import React from 'react'; import { ImageBackground, Text, View, SafeAreaView, StyleSheet } from 'react-native'; import Button from "./src/components/Button"; c
import React from 'react';
import { ImageBackground, Text, View, SafeAreaView, StyleSheet } from 'react-native';
import Button from "./src/components/Button";
const Explore = ({}) => {
return (
<ImageBackground
style={s.background}
source={require('./src/assets/images/explore.png')}
>
<SafeAreaView style={s.safeArea}>
<View style={s.wrapper}>
<View style={s.header}>
<Text style={s.title}>Explore</Text>
<Text style={s.subTitle}>new amazing countries</Text>
</View>
<View style={s.spacer} />
<View style={s.controls}>
<Button
style={s.button}
label="Log in"
/>
</View>
</View>
</SafeAreaView>
</ImageBackground>
);
};
const s = StyleSheet.create({
background: {
width: '100%',
height: '100%',
},
safeArea: {
flex: 1,
},
wrapper: {
flex: 1,
padding: 25,
},
header: {
paddingTop: 20,
},
title: {
fontSize: 24,
fontFamily: 'RobotoSlab-Bold',
color: '#323B45',
},
subTitle: {
fontSize: 20,
fontFamily: 'RobotoSlab-Light',
color: '#323B45',
},
spacer: {
flex: 1,
},
controls: {
flexDirection: 'row'
},
button: {
flex: 1
},
gap: {
width: 25
}
});
export default Explore;
从“React”导入React;
从“react native”导入{ImageBackground,Text,View,SafeAreaView,StyleSheet};
从“/src/components/Button”导入按钮;
常量Explore=({})=>{
返回(
探索
新的神奇国家
);
};
const s=StyleSheet.create({
背景:{
宽度:“100%”,
高度:“100%”,
},
安全区:{
弹性:1,
},
包装器:{
弹性:1,
填充:25,
},
标题:{
paddingTop:20,
},
标题:{
尺寸:24,
fontFamily:“RobotoSlab Bold”,
颜色:“#323B45”,
},
副标题:{
尺寸:20,
fontFamily:“机器人平板灯”,
颜色:“#323B45”,
},
垫片:{
弹性:1,
},
控制:{
flexDirection:“行”
},
按钮:{
弹性:1
},
差距:{
宽度:25
}
});
导出默认值;
有人知道我如何让android上的背景覆盖整个屏幕,就像在ios上一样吗
更新:
我们已设法用以下代码覆盖状态栏:
<StatusBar translucent backgroundColor='transparent' />
react native navigation bar color
解决了我在底部导航栏上的问题,在状态栏上解决了我的问题。尝试设置状态栏的半透明道具[@Hariks谢谢你的提示!我已经设法用以下代码覆盖了状态栏:
。现在,只剩下底部导航。你能试试paddinBottom:0
?@hongdevelop不,它不起作用了。再试试这个paddinBottom:-30
酷…太棒了,谢谢兄弟,它起作用了