android - 无法更改导航栏颜色

标签 android xamarin xamarin.android

我尝试了很多东西来改变导航栏的颜色,比如

Android lollipop change navigation bar color

android change navigation bar color

How to change system navigation bar color

没有效果

我将项目添加到 styles.xml - 使用 Android 8.1

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

任何人都知道在 Xamarin.Android 中执行此操作的最佳方法是什么

更新:我在样式文件中尝试了以下代码

  <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="android:windowFullscreen">true</item>
    <item name="android:windowNoTitle">true</item>
    <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
  </style>

  <style name="DrawerArrowStyle" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="color">@color/red</item>
  </style>

  <style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    <item name="android:windowFullscreen">true</item>
    <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
  </style>

最佳答案

While fixing another issue I had to change and minimum API level to Lollipop and noticed that <itemname="android:navigationBarColor">@color/theme_color</item> started working when minimum API level is set to Lollipop.

所以我认为出于某种原因,Xamarin 需要使用最低 API 版本 Lollipop 才能工作

关于android - 无法更改导航栏颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49315113/

相关文章:

c# - Xamarin Forms Android DatePicker - 只希望显示微调器,但日历也是如此

java - 将蓝牙 Android 客户端连接到蓝牙 Java 服务器

c# - MvvmCross 自定义事件绑定(bind)事件参数

android - 为什么我无法收到 POWER CONNECTED 操作?

java - 使用 ViewPager 在 Xamarin.Android 上以轮播样式显示图像幻灯片并使用突出的子项进行填充,Viewpager 错误地计算参数

c# - 计划和取消任务列表

c++ - 在 MonoTouch 和 MonoDroid 中使用现有的 c++ 库

c# - Azure 移动服务无法在 xamarin.android 上运行

java - 在 android 中退出 NavUtils 的应用程序

android - 如何在android中从另一个应用程序调用一个应用程序