【问题标题】:React Native: Android windowLightNavigationBar not change button colorsReact Native:Android windowLightNavigationBar 不更改按钮颜色
【发布时间】:2021-04-03 04:50:37
【问题描述】:

在我的 react-native 应用程序中,我想将底部导航栏颜色更改为白色。通过将以下行添加到我的 src/main/res/value/styles.xml 文件中,我能够将颜色更改为白色。

 <item name="android:navigationBarColor">@android:color/white</item>

但是当我在模拟器或物理设备上运行它时。它显示如下。我想让底部导航栏中的按钮突出显示,以便用户可以清楚地看到这些按钮。

实际输出

预期输出

到目前为止我做了什么

  1. 尝试将 &lt;item name="android:windowLightNavigationBar"&gt;true&lt;/item&gt; 添加到styles.xml 文件。
  2. 尝试创建values-28 文件夹并添加styles.xml 文件 如上所述here
  3. 尝试将parent="Theme.AppCompat.Light.NoActionBar 更改为 parent="Theme.AppCompat.DayNight.NoActionBar
  4. 如前所述尝试创建新模拟器 here
  5. 也试过this

但他们似乎都没有解决我的问题。

我的styles.xml 文件如下所示。

<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="android:windowLightNavigationBar">true</item>
    <item name="android:navigationBarColor">@android:color/white</item>

</style>

build.gradle 看起来像这样。

    buildToolsVersion = "29.0.3"
    compileSdkVersion = 29
    minSdkVersion    = 27
    targetSdkVersion = 29
    supportLibVersion = "28.0.0"

我已经在以下设备上进行了测试

  1. Pixel 4 API 30(模拟器)
  2. Pixel 3A XL API 27(模拟器)
  3. Redmi Note 7(物理设备 - Android 10)
  4. 小米 Note 10 Lite(物理设备 - Android 10)

任何帮助将不胜感激。

【问题讨论】:

    标签: android react-native android-layout react-native-android


    【解决方案1】:

    也尝试添加这一行。

    <item name="android:windowDrawsSystemBarBackgrounds">true</item>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-05-23
      • 2018-08-01
      • 2023-01-28
      • 2020-08-03
      • 2014-07-11
      相关资源
      最近更新 更多