【发布时间】:2019-09-03 14:53:58
【问题描述】:
带有主从模板。 我在 app.xaml 上设置颜色 在安卓上运行良好。但无论我做什么,都会在 iO 上保持白色背景。
尝试在单个页面的 xaml 上设置背景。
尝试在代码后面设置背景。
app.xaml
<Color x:Key="NavigationPrimary">#007DC6</Color>
<Color x:Key="NavigationBackground">#E4EBF1</Color>
<Color x:Key="NavigationBackgroundShadow">#D8E1E6</Color>
<Style TargetType="NavigationPage">
<Setter Property="BarBackgroundColor" Value="{StaticResource NavigationPrimary}" />
<Setter Property="BarTextColor" Value="White" />
<Setter Property="BackgroundColor" Value="{StaticResource NavigationBackground}" />
</Style>
about.xaml - 框架
<Frame BackgroundColor="{StaticResource NavigationBackgroundShadow}"
CornerRadius="10"
Margin="0,5"
x:Name="FrmDistribuidora"
IsClippedToBounds="True"
Padding="5"
HeightRequest="60"
BorderColor="#999999">
<Label Text="Test" VerticalOptions="Center" HorizontalOptions="Center"/>
</Frame>
重现代码...
• 使用 android 和 IOS 以及 Master-Detail 模板创建一个新的 xamarin 项目。
• 粘贴 app.xaml 资源。
• 将框架代码粘贴到 about.xaml
【问题讨论】:
标签: c# ios xaml xamarin.forms