更改Xamarin移动应用程序的工具栏颜色
我是xamarin.forms开发的新手,我正在使用VisualStudio 2019实现同样的目标。我正在开发一个示例shell应用程序,但无法更改工具栏的颜色(图片中为蓝色)。谁能在这个问题上帮助我更改Xamarin移动应用程序的工具栏颜色,xamarin,xamarin.forms,xamarin.android,visual-studio-2019,Xamarin,Xamarin.forms,Xamarin.android,Visual Studio 2019,我是xamarin.forms开发的新手,我正在使用VisualStudio 2019实现同样的目标。我正在开发一个示例shell应用程序,但无法更改工具栏的颜色(图片中为蓝色)。谁能在这个问题上帮助我 我们可以通过在shell.xaml 例如,我们将其设置为绿色 <Shell xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
我们可以通过在
shell.xaml
例如,我们将其设置为绿色
<Shell xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:local="clr-namespace:xxx"
Title="xxx"
BackgroundColor="Green"
x:Class="xxx.AppShell">
你有没有在你的房间里试过这个颜色Navigation@Prasanth我在shellItem中没有找到这样的属性。你能帮我吗。
<Shell.Resources>
<ResourceDictionary>
<Color x:Key="NavigationPrimary">#2196F3</Color> //color of TabBar
<Style x:Key="BaseStyle" TargetType="Element">
<Setter Property="Shell.BackgroundColor" Value="{StaticResource NavigationPrimary}" />
<Setter Property="Shell.ForegroundColor" Value="White" />
<Setter Property="Shell.TitleColor" Value="White" />
<Setter Property="Shell.DisabledColor" Value="#B4FFFFFF" />
<Setter Property="Shell.UnselectedColor" Value="#95FFFFFF" />
<Setter Property="Shell.TabBarBackgroundColor" Value="{StaticResource NavigationPrimary}" />
<Setter Property="Shell.TabBarForegroundColor" Value="White"/>
<Setter Property="Shell.TabBarUnselectedColor" Value="#95FFFFFF"/>
<Setter Property="Shell.TabBarTitleColor" Value="White"/>
</Style>
<Style x:Key="MyBaseStyle" TargetType="Element">
<Setter Property="Shell.ForegroundColor" Value="White" />
<Setter Property="Shell.TitleColor" Value="White" />
<Setter Property="Shell.DisabledColor" Value="#B4FFFFFF" />
<Setter Property="Shell.UnselectedColor" Value="#95FFFFFF" />
<Setter Property="Shell.TabBarBackgroundColor" Value="{StaticResource NavigationPrimary}" />
<Setter Property="Shell.TabBarForegroundColor" Value="White"/>
<Setter Property="Shell.TabBarUnselectedColor" Value="#95FFFFFF"/>
<Setter Property="Shell.TabBarTitleColor" Value="White"/>
</Style>
<Style TargetType="ShellItem" BasedOn="{StaticResource BaseStyle}" />
<Style TargetType="TabBar" BasedOn="{StaticResource MyBaseStyle}" />
</ResourceDictionary>
</Shell.Resources>
<!-- Your Pages -->
<TabBar >
<Tab Title="xxx" Icon="xxx" >
<ShellContent ContentTemplate="{DataTemplate xxx}" />
</Tab>
<Tab Title="xxx" Icon="xxx">
<ShellContent ContentTemplate="{DataTemplate xxx}" />
</Tab>
</TabBar>