【问题标题】:Statusbar Color won't change on iOSiOS 上的状态栏颜色不会改变
【发布时间】:2017-07-21 14:34:42
【问题描述】:

我正在尝试为我的状态栏着色,但在 iOS 版本上它不会改变它的颜色。 这是我的代码:

render(){
return(
  <View>
    <StatusBar backgroundColor="#553A91" barStyle="dark-content" />
    <List containerStyle={{borderTopWidth: 0, borderBottomWidth: 0}}>
    <FlatList
    data={this.state.data}
    renderItem={({item})=>(
      <ListItem
      roundAvatar
      title={`${item.name.first} ${item.name.last}`}
      subtitle={item.location.city}
      avatar={{uri: item.picture.thumbnail}}
      containerStyle={{borderBottomWidth: 0}}
      />
    )}
    keyExtractor={item=>item.email}
    ItemSeparatorComponent={this.renderSeparator}
    ListHeaderComponent={this.renderHeader}
    />
    </List>
  </View>
);

};

它是这样的:

如何更改状态栏的背景颜色?

【问题讨论】:

标签: react-native


【解决方案1】:

状态栏的背景颜色只能在 Android 上更改。在 iOS 上,您只能更改 barStyle 属性。

状态栏在 iOS 上是透明的。你可以在你的状态栏后面有一个Viewheight: 20,如果你想模拟它,可以更改背景颜色。

但 iOS 应用的状态栏通常没有不同的颜色。

【讨论】:

  • 谢谢,我会努力的。
猜你喜欢
  • 1970-01-01
  • 2014-12-17
  • 2021-08-03
  • 1970-01-01
  • 1970-01-01
  • 2015-11-06
  • 1970-01-01
  • 2015-09-22
  • 1970-01-01
相关资源
最近更新 更多