【问题标题】:How to stretch the container view below the statusBar in Android如何在Android中拉伸状态栏下方的容器视图
【发布时间】:2020-08-29 11:56:34
【问题描述】:

我正在使用 React Navigation 堆栈,其中嵌套了一个选项卡导航。在 iPhone 上,他们以 flex 1 样式查看的视图填满了整个屏幕,而在 android 上,视图一直延伸到状态栏。我希望视图填满整个屏幕。 它在 Iphone 上运行良好。

 render() {
    return(
        <View style={Style.cont}>

        </View>
    )
}


}
export default Profile
const Style = StyleSheet.create({
cont:{
    flex:1,
    backgroundColor:'#1f2125',

}
})

[![在此处输入图片描述][1]][1]

[1]:https://i.stack.imgur.com/IBK1k.jpg![enter此处的图片描述](https://i.stack.imgur.com/uIL2Z.png)

【问题讨论】:

  • 请添加更多详细信息,说明您尝试过的内容以及您想要实现的确切目标。
  • 我已经编辑过了。可以看看吗?

标签: android reactjs react-native


【解决方案1】:

您可以尝试添加状态栏组件并为其设置所需的背景颜色

https://reactnative.dev/docs/statusbar

【讨论】:

    【解决方案2】:

    原来我不得不使用 expo 提供的 StatusBar。 从“expo-status-bar”导入 {StatusBar} 而不是从“react-native”导入 {StatusBar}

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-12
      • 1970-01-01
      • 2012-11-16
      相关资源
      最近更新 更多