【问题标题】:Change navigation bar back button color in xamarin android在xamarin android中更改导航栏后退按钮颜色
【发布时间】:2017-09-16 02:40:59
【问题描述】:

在我的应用程序中,默认的后退按钮颜色是白色。我需要将后退按钮颜色更改为黑色。我尝试了很多帖子来更改导航栏的后退按钮,但没有运气。你能提出任何想法吗?这是我的主题设计。

style.axml:

 <resources>
   <style name="MyTheme" parent="MyTheme.Base">
   </style>
   <style name="Theme.Splash" parent="@android:style/Theme.NoTitleBar.Fullscreen">         
    <item name="android:windowBackground">@drawable/Splash</item>
    <item name="android:windowNoTitle">true</item>
   </style>
   <style name="MyTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
     <item name="colorPrimary">@color/primary</item>
    <item name="colorPrimaryDark">@color/primaryDark</item>   
    <item name="colorAccent">@color/accent</item>
    <item name="android:windowBackground">@color/window_background</item>
   </style>
 </resources> 

styles.xml:

<resources>
  <style name="MainTheme" parent="MainTheme.Base">
  </style>     
  <style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">      
    <item name="windowNoTitle">true</item>   
    <item name="windowActionBar">false</item>    
    <item name="colorPrimary">#fcce47</item>    
    <item name="colorPrimaryDark">#000000</item>    
    <item name="colorAccent">#000000</item>    
    <item name="windowActionModeOverlay">true</item>
    <item name="android:textCursorDrawable">@null</item>
    <item name="android:datePickerDialogTheme">@style/AppCompatDialogStyle</item>
  </style>

  <style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
     <item name="colorAccent">#FF4081</item>
  </style>
</resources>

【问题讨论】:

  • 您可以通过 Navigation BarTextColor 属性对其进行更改。无需添加到主题中。
  • 您好,我想更改导航栏的后退按钮颜色而不是文本颜色。
  • 导航返回按钮和标题颜色将由 BarTextColor 属性更改。后退按钮和标题颜色相同。
  • 我已经设置了bar text color属性是黑色但不是运气,导航栏中的返回按钮只显示白色。

标签: xamarin xamarin.android


【解决方案1】:

我在styles.xml中写了下面的代码

你必须在 mytheme.base 中写下一行

<item name="drawerArrowStyle">@DrawerArrowStyle</item>

你必须在上面的样式标签外面写下面的代码:

<style name = "DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
 <item name="color">@color/BackButtonColor</item>
</style>

【讨论】:

    猜你喜欢
    • 2015-04-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-16
    • 1970-01-01
    相关资源
    最近更新 更多