繁体   English   中英

更改android中后退按钮的颜色

[英]Change color of back button in android

无法在 android 中更改后退按钮的颜色。 在ios中,运行良好。

((NavigationPage)Application.Current.MainPage).BackgroundColor = (Color)App.Current.Resources["white"];
((NavigationPage)Application.Current.MainPage).BarBackgroundColor = (Color)App.Current.Resources["white"];
((NavigationPage)Application.Current.MainPage).BarTextColor = (Color)App.Current.Resources["texto"];

预期:后退按钮颜色为黑色。

实际结果:返回按钮颜色为白色。

正如您在此处看到的,它目前不受支持,并且在 GitHub 上有一个未解决的问题。 现在,您应该使用自定义渲染器或在您的样式中定义一个主题。

在你的 Android 项目Resources/layout/styles.xml 中添加 ToolbarTheme 样式

<style name="ToolbarTheme" parent="ThemeOverlay.AppCompat.Light">
    <item name="colorControlNormal">@android:color/black</item>
</style>

然后将android:theme="@style/ToolbarTheme"Resources/layout/Toolbar.axml 中的工具栏

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM