reactnative 修改状态栏的yan

前言

官网StatusBar讲的详细,大家翻翻看,这里直接贴一段简明扼要的代码供大家使用:

export default class ViewProject extends Component {  

  render() {  
    return (  
      <View style={styles.container}>  
        <StatusBar  
         animated={true} //指定状态栏的变化是否应以动画形式呈现。目前支持这几种样式:backgroundColor, barStyle和hidden  
         hidden={false}  //是否隐藏状态栏。  
         backgroundColor={'green'} //状态栏的背景色  
         translucent={true}//指定状态栏是否透明。设置为true时,应用会在状态栏之下绘制(即所谓“沉浸式”——被状态栏遮住一部分)。常和带有半透明背景色的状态栏搭配使用。  
         barStyle={'light-content'} // enum('default', 'light-content', 'dark-content')   
        >  
        </StatusBar>  
      </View>  
    );  
  }    
}

猜你喜欢

转载自blog.csdn.net/mffandxx/article/details/80288565