简体   繁体   English

在android中隐藏状态栏

[英]Hide Status bar in android

I am using react native 0.55.3 How can do like in a image我正在使用 react native 0.55.3 How can do like in a image

Android screen shot安卓屏幕截图

在此处输入图片说明

to

Ios screen shot ios屏幕截图

在此处输入图片说明

为此,您可以使用 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.这里Color根据平台。

<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.使您的colorPrimaryDark 与colors.xml 中的colorAccent 相同。 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' :如果您使用'react-native-navigation'

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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