xamarin - Xamarin Forms:如何更改 Master Detail 内容页面的背景颜色?
问题描述
我的项目中有一个主详细信息页面,并在其中添加了一些内容页面作为子项。如何更改子内容页面顶部栏的颜色?我在顶部栏上添加了一些图标,使用<NavigationPage.TitleView>
.
我需要更改红色方形背景颜色。我已经尝试过这里首选的解决方案,但这并不能解决我的问题。
解决方案
要更改Android导航栏的背景颜色,请执行以下步骤:
Go to your Android Project -> Resources -> values -> styles.xml
colorPrimary
使用所需的十六进制颜色代码打开 style.xaml 文件更新值
<!-- colorPrimary is used for the default action bar background -->
<item name="colorPrimary">#3478c9</item>
对于iOS,这可以通过 App.xaml 文件进行控制,无需在 iOS 项目中编写任何内容
<Application.Resources>
<ResourceDictionary>
<!-- Styles -->
<Style TargetType="NavigationPage">
<Setter Property="BarBackgroundColor" Value="#3478c9"/>
<Setter Property="BarTextColor" Value="White"/>
</Style>
<!-- Styles -->
</ResourceDictionary>
</Application.Resources>
推荐阅读
- python - 如何在 Windows 上使用 python3 执行交互式 .exe 命令
- email - 为 Mailjet 创建新联系人并添加到现有列表
- python - 与 Qt/PyQt 中的 KeyPress 事件相比,如何加快 QPushButton 的按下信号的延迟?
- flutter - 在有状态小部件外部调用方法以使用颤振 Bloc 更新 UI
- python - 提高列表创建的性能
- excel - 自动过滤仅返回两个数字之间的数据,但返回空白
- firebase - 参数不匹配的闭包调用:颤振中的函数'[]'
- c++ - 广播类似于 Numpy 的犰狳矩阵运算的最佳方式
- android - 如何在 ViewHolder Android Studio 中设置可绘制背景?
- c# - 检查是随机创建的添加的答案在 C# 中是否正确