当我的应用加载TitleView后,在menu.png图标后启动BackgroundColor。我选择其中一个设置detailPage.BarBackgroundColor的菜单项后,我才能使它工作? 是……
首先,如果你想要一个白色背景,尝试使用这个代码
<?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Pages.MenuPage" xmlns:telerikPrimitives="clr-namespace:Telerik.XamarinForms.Primitives;assembly=Telerik.XamarinForms.Primitives" xmlns:telerik="clr-namespace:Telerik.XamarinForms.DataControls;assembly=Telerik.XamarinForms.DataControls" xmlns:model="clr-Model" xmlns:page="clr-Pages" Title="Menu" Icon="menu.png" BackgroundColor="#FFFFFF" >
或使用它:
<NavigationPage.TitleView> <StackLayout Orientation="Horizontal" BackgroundColor="#FFFFFF" > <Label Text="App" HorizontalOptions="FillAndExpand" VerticalOptions="CenterAndExpand" BackgroundColor="#22335c" TextColor="White" HorizontalTextAlignment="Center" /> </StackLayout> </NavigationPage.TitleView>
我更喜欢用它:
MainPage = new NavigationPage (new MainView()) { BarBackgroundColor = Color.White, BarTextColor = Color.NavyBlue };
如果要重叠2个蓝色条纹,请尝试使用不带背景的图标。以制作或获取SVG图为例,并使用paint转换为png。
这个图是给你的一个例子: 没有背景链接的图
问候
我有点困惑,因为它似乎太明显了,但这有效:
<pages:MenuPage x:Name="menuPage"/> </MasterDetailPage.Master> <MasterDetailPage.Detail> <NavigationPage BarBackgroundColor ="#22335c"> <x:Arguments> <pages:HomePage /> </x:Arguments> </NavigationPage> </MasterDetailPage.Detail>