【问题标题】:How to change the color of the menu icon on the MasterPageDetalis xamarin.forms?如何更改 MasterPageDetalis xamarin.forms 上菜单图标的颜色?
【发布时间】:2019-03-17 14:07:31
【问题描述】:

我正在创建一个项目,需要更改菜单图标,但我还没有找到解决方案。如何更改 MasterPageDetalis xamarin.forms 中菜单图标的颜色?

【问题讨论】:

标签: xamarin xamarin.forms


【解决方案1】:

从 style.xml 更改您的基本主题

<style name="MyTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
            <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
        </style>
        <style name="DrawerArrowStyle" parent="@style/Widget.AppCompat.DrawerArrowToggle">
            <item name="spinBars">true</item>
            <item name="color">@color/green</item>
        </style>

如果我错了请指教

【讨论】:

  • 它可以工作,谢谢,但没有必要指定 spinBars 属性
【解决方案2】:

在新版本的表单中,您可以像这样更改 ActionBar 颜色(和文本颜色):

var navigon = new NavigationPage(new WebViewPage());
    navigon.BarBackgroundColor = Color.Teal;
    navigon.BarTextColor = Color.White;

如果您使用 MasterDetailPage,则在 MasterDetailPage 中使用覆盖 OnAppearing 它应该可以工作。

【讨论】:

  • 更改了栏的颜色和其中的文本,但想更改菜单图标的颜色。
  • navigon.BarTextColor 为操作栏设置了图标和文本的颜色,如果您只想更改图标颜色,请使用 @android:color/black android 项目 styles.xml 用于 android
猜你喜欢
  • 2023-04-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-10-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多