- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想改变工具栏上的后退符号的颜色,目前工具栏是黑色的。为了视觉清晰,这里是左上角带有“后退”箭头的屏幕截图。正如您在屏幕截图中看到的,我已经更改了文本和背景的颜色。
Screenshot: Contentpage with black "back" arrow
该项目分为Client
、Client.Android
和Client.iOS
。该应用程序目前主要针对 Android,但我们希望为 iOS 敞开大门。
如果有任何遗漏,我也会尝试将其粘贴在这里。
MasterDetailsPage.xaml.cs:
public partial class MasterDetailPage1: MasterDetailPage
{
public MasterDetailPage1()
{
this.InitializeComponent();
this.MasterPage.ListView.ItemSelected += this.ListView_ItemSelected;
}
protected override void OnChildAdded(Element child)
{
if(child is NavigationPage page)
{
page.BarBackgroundColor = Color.FromHex("343A40");
page.BackgroundColor = Color.FromHex("343A40");
page.BarTextColor = Color.FromHex("FFFFFF");
}
base.OnChildAdded(child);
}
}
ReportConfigurationPage.xaml.cs
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
x:Class="Company.Client.Views.ReportConfigurationPage"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
<ContentPage.Content>
<ScrollView x:Name="ScrollView" BackgroundColor="White">
<StackLayout x:Name="BaseStackLayout" Orientation="Vertical">
<!-- Input controls -->
</StackLayout>
</ScrollView>
</ContentPage.Content>
</ContentPage>
更新:啊,谢谢,需要在 styles.xml 中定义和分配的是 DrawerArrowStyle
。
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="DrawerArrowStyle" parent="@style/Widget.AppCompat.DrawerArrowToggle">
<item name="spinBars">true</item>
<item name="color">#FFFFFF</item>
</style>
<style name="MainTheme" parent="MainTheme.Base">
</style>
<!-- Base theme applied no matter what API -->
<style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<!--If you are using revision 22.1 please use just windowNoTitle. Without android:-->
<item name="windowNoTitle">true</item>
<!--We will be using the toolbar so no need to show ActionBar-->
<item name="windowActionBar">false</item>
<!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette -->
<!-- colorPrimary is used for the default action bar background -->
<item name="colorPrimary">#FF0000</item>
<!-- colorPrimaryDark is used for the status bar -->
<item name="colorPrimaryDark">#219198</item>
<!-- colorAccent is used as the default value for colorControlActivated
which is used to tint widgets -->
<item name="colorAccent">#219198</item>
<!-- You can also set colorControlNormal, colorControlActivated
colorControlHighlight and colorSwitchThumbNormal. -->
<item name="colorControlHighlight">#219198</item>
<item name="windowActionModeOverlay">true</item>
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
<item name="android:datePickerDialogTheme">@style/AppCompatDialogStyle</item>
</style>
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
<item name="colorAccent">#FF4081</item>
</style>
</resources>
最佳答案
Android 中有一个概念叫做Material design .
由于 Xamarin 在 Xamarin.Android 中采用了 native Java Android 行为,因此 Android 应用程序会在其 styles.xml 文件中选择主题并使用该样式来设置栏背景颜色。
当然,有一个解决方法。无论您需要在 Android 端做什么更改,您都必须在样式文件中更新它,例如:
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="MyTheme" parent="MyTheme.Base">
</style>
<style name="DrawerArrowStyle" parent="@style/Widget.AppCompat.DrawerArrowToggle">
<item name="spinBars">true</item>
<item name="color">#FFFFFF</item>
</style>
<style name="MyTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="colorPrimary">#003399</item>
<item name="colorPrimaryDark">#003399</item>
<item name="colorControlHighlight">#003399</item>
<item name="colorAccent">#012348</item>
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
</style>
</resources>
此处颜色的变化将直接反射(reflect)到那里,例如 ColorPrimary 是您的工具栏背景颜色 (BarBackgroundColor)。
更新
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/toolbar"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:theme="@style/ToolbarTheme" >
</android.support.v7.widget.Toolbar>
然后得到像这样的工具栏:
var toolbar=yourActivityContext.Window.DecorView.FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
toolbar.SetBackgroundColor(Android.Graphics.Color.Your_Color);
//In case of hex color
toolbar.SetBackgroundColor(Android.Graphics.Color.ParseColor("#ebebeb"));
关于c# - Xamarin 表格 : How to change the color the "back" symbol in the toolbar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53485096/
我们的开发环境是这样配置的,当我们运行代码的调试版本时,它会在崩溃或 ^C 时进入 gdb。随着最近的一些更改,这种情况不再发生(退出程序而不是进入 gdb),我怀疑符号大小的增加导致了这个问题。 有
刚刚浏览了一个教程,想到了我看到的地方 first_name: 还有一个地方 :first_name 这样对吗?有什么区别? 最佳答案 哈希语法在 Ruby 1.9.2 中发生了变化,以更接近 jso
这里是一个相当抽象的问题,因为我不知道从哪里开始我自己的调查。 我有一个用 CMake 构建的 C 包,它生成 librpdb.so;我为同一个库设置了一个 Ruby Gem,它生成 rpdb.bun
我尝试使用 Symbol 创建对象键并用 Symbol.for 找到对应的值,但它不起作用: const sym = Symbol("x"); let obj = { [sym]: "val" }
这可能是一个愚蠢的问题,但我很高兴知道为什么我们使用带有一些标志的短形式的单符号和带有完整标志的双符号? 例子: 1) -h & --help 2) -f & --force 谁能解释一下原因? 最
我们希望能够在删除物理构建区域时删除符号服务器内容,symstore del 命令对事务 ID 起作用。这是未知的。 How to extract the transaction ID based o
我在一个我不太理解的小程序上遇到这个问题(我对节点红色有点陌生),代码是 var profile = msg.user.profile; var cart = profile.cart = pr
我正在尝试创建一种工资单以在控制台中打印,但我从代码中收到以下错误。很多时候它实际上只是一个错误,但我认为我没有足够的 java 知识来自己修复它。 import java.io.*; import
在 C# 项目中,我在 UnhandledException 中创建了小型转储。在我的 Dev 机器中,项目源和 bin 位于路径 K:\projects\*MYPROJECT* 下,如果我设法让它在
我正在尝试针对另一个使用 libcurl 共享库的共享库 (libtheirstuff.so) 交叉编译我自己的共享库 (libmystuff.so),但出现以下错误: libmystuff.so:
我试图遍历一个数组来检查它是否包含任何通过指定函数的项目。我通过向 Array 对象添加一个 .any() 原型(prototype)来做到这一点: Array.prototype.any = (co
除了这个 undefined symbol 错误外,一切正常: bash-3.2$ make g++ -Wall -g solvePlanningProblem.o Position.o AStarN
我 rsync 目录“Promotion”包含两台具有不同目录结构的机器之间的绝对符号链接(symbolic link)。因此绝对符号链接(symbolic link)在两台机器上都不起作用。为了使它
我有以下 JSX - What is your e-mail address? setStateForProperties(e)}
根据 SVG 的 symbol文档,我可以添加 refX/refY属性给它。 如果我理解正确,我可以使用这些属性来定义符号坐标系中的引用点,因此当我使用 引用它时元素,它将相对于该引用点(而不是默认
请解释以下有关“找不到符号”,“无法解析符号”或“找不到符号”错误的信息: 是什么意思? 什么原因可以导致它们? 程序员如何解决它们? 该问题旨在对Java中的这些常见编译错误进行全面的问答。 最佳答
请解释以下有关“找不到符号”,“无法解析符号”或“找不到符号”错误的信息: 是什么意思? 什么原因可以导致它们? 程序员如何解决它们? 该问题旨在对Java中的这些常见编译错误进行全面的问答。 最佳答
请解释以下有关“找不到符号”,“无法解析符号”或“找不到符号”错误的信息: 是什么意思? 什么原因可以导致它们? 程序员如何解决它们? 该问题旨在对Java中的这些常见编译错误进行全面的问答。 最佳答
请解释以下有关“找不到符号”,“无法解析符号”或“找不到符号”错误的信息: 是什么意思? 什么原因可以导致它们? 程序员如何解决它们? 该问题旨在对Java中的这些常见编译错误进行全面的问答。 最佳答
请解释以下有关“找不到符号”,“无法解析符号”或“找不到符号”错误的信息: 是什么意思? 什么原因可以导致它们? 程序员如何解决它们? 该问题旨在对Java中的这些常见编译错误进行全面的问答。 最佳答
我是一名优秀的程序员,十分优秀!