【发布时间】:2020-03-13 09:47:25
【问题描述】:
我正在为 Android 开发一个 Xamarin 应用程序,它使用顶部的标签条,如下所示:-
我改变后的只是标签底部的颜色(箭头指向的地方)。目前它是白色的,但我希望它设置为不同的颜色。
我的 MainPage.xaml 中有这个:-
<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:views="clr-namespace:App.Views"
x:Class="App.Views.MainPage" BarBackgroundColor="#151c3e" BarTextColor="{StaticResource MainTextColour}">
<TabbedPage.Children>
<NavigationPage Title="Location">
<x:Arguments>
<views:LocationPage />
</x:Arguments>
</NavigationPage>
...
在 App.xaml 中指定 MainTextColour 的位置如下:-
<?xml version="1.0" encoding="utf-8" ?>
<Application xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="App.App">
<Application.Resources>
<ResourceDictionary>
<!--Global Styles-->
<Color x:Key="MainBackgroundColour">Black</Color>
<Color x:Key="MainTextColour">Red</Color>
<Style TargetType="NavigationPage">
<Setter Property="BarBackgroundColor" Value="{StaticResource MainBackgroundColour}" />
<Setter Property="BarTextColor" Value="{StaticResource MainTextColour}" />
</Style>
</ResourceDictionary>
</Application.Resources>
有什么想法吗?
【问题讨论】:
-
@Andrew - 是的,谢谢。不知道为什么我之前没有看到那个帖子。谢谢。
-
@GarryPilkington 看来您的问题已经解决了,请记得标记任何有用的回复以关闭您的帖子,谢谢。
标签: xamarin.forms