gpt4 book ai didi

android - 如何更改 Android/React Native 中的灰色顶部横幅?

转载 作者:行者123 更新时间:2023-12-04 12:15:44 37 4
gpt4 key购买 nike

enter image description here
请注意,应用程序上方有一个中灰色横幅。我怎样才能

  • 删除它(应用程序最好在 9:56 以下开始)
  • 更改背景颜色(不太理想)
  • 最佳答案

    TLDR;
    这是 Pixel 4 模拟器上的显示错误。 Real Pixel 4 没有这个差距。

    编辑
    我在下面的回答不是很准确。我尝试使用带有圆角的模拟 Pixel 4、API 29(使用 Android Studio 4.2、macOS Big Sur),就像你的那样,这似乎是手机曲线的问题,而不是空的 ActionBar .
    我在像素 4 上的应用:
    With rounded corners
    甚至 Youtube 也有这个空间:
    Even youtube
    编辑 2
    a real Pixel 4 相比
    Compared with real one
    我们清楚地看到,这个巨大的差距只在模拟器上。
    这是模拟器上的一个错误,这可能是网络上没有人谈论它的主要原因(谷歌搜索 Pixel 4 状态栏高度显示愤怒的 Pixel 5 所有者对其巨大高度的结果)。
    没有发现任何关于它的错误报告,我会提交一份。

    旧答案
    你看到的可能是一个空的 ActionBar ,与您的 StatusBar 颜色相同.
    如果您使用默认主题,your app will use it :

    Beginning with Android 3.0 (API level 11), all activities that use the default theme have an ActionBar as an app bar.


    它显示您的应用程序名称,在您的 MainApplication 中定义。的 android:label在您的 AndroidManifest.xml 上(或 MainActivity 如果找不到)。因为它是空的,所以只显示一个空白空间。
    当您管理自己的导航栏时,您可以使用您选择的基本主题禁用 Theme.AppCompat.*.NoActionBar ,在值/styles.xml 上:
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- You can set the color of your status bar here, or with RN - see further on the answer -->
    <item name="android:statusBarColor">@color/dark</item>
    </style>
    不要忘记将此主题应用于您的 MainApplication ,在您的 AndroidManifest.xml 中:
    <application
    android:name=".MainApplication"
    android:theme="@style/AppTheme"
    ...
    为了更好地说明,下面是它的样子:
    NoActionBar (上面的代码)
    New config
    parent="Theme.AppCompat.Light"<item name="android:statusBarColor">@color/dark</item> With name and light
    parent="Theme.AppCompat" ,以及一个空的应用名称。
    With empty app name

    对于问题的第二部分,您可以在此处更改状态栏的颜色 ( see the docs for this),或 within React Native .

    关于android - 如何更改 Android/React Native 中的灰色顶部横幅?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67777748/

    37 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com