简体   繁体   中英

Hide Status bar in android

I am using react native 0.55.3 How can do like in a image

Android screen shot

在此处输入图片说明

to

Ios screen shot

在此处输入图片说明

为此,您可以使用 react-native 的StatusBar组件 api,这将有助于隐藏状态栏,并且您可以根据您所处的场景更改状态栏的颜色。

I'm not able to understand your point. But answering on the possibility you trying to achieve. Here Color as per platform.

<StatusBar
     backgroundColor= {Platform.os =="ios"? "IOS_COLOR_CODE" : "ANDROID_COLOR_CODE"}
     barStyle="light-content"
   />

Hiding status bar

<StatusBar
    hidden ={true}
    barStyle="light-content"
 />
 <StatusBar backgroundColor={'transparent'} translucent={true} />

Image:

在此处输入图片说明

Make your colorPrimaryDark same as that of colorAccent in colors.xml. I think you have added some extra view above the actionbar

you can hide Status bar like this:

 <StatusBar
    hidden={true}
 />

or

StatusBar.setHidden(true);


and change the color:

<StatusBar
  backgroundColor="pink"
  barStyle="light-content"
/>

or

StatusBar.setBackgroundColor('pink');


if you use 'react-native-navigation' :

 appStyle: {
    statusBarColor: 'pink',
    statusBarTextColorScheme: 'light-content',
    statusBarHidden: true,
 }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM