huz*_*ack 1 c# xaml xamarin.forms
我在a 上使用了一个红色图标Toolbar,但它仍然保持蓝色,就像默认情况一样.如何将其更改为红色.因为最初图标的颜色最初是红色的.我怎么能解决这个问题呢.
以下是图片:
这是Xaml代码:
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
Icon ="nav_icon.png" Title="Ea "
x:Class="EAMobileDirectory.MasterPage">
<StackLayout>
<Image Source="featured_newline_1.png" Margin="0,1,0,0"/>
<ListView x:Name="listView" Margin="0,10,0,0" VerticalOptions="FillAndExpand" SeparatorVisibility="None">
<ListView.ItemTemplate>
<DataTemplate>
<ImageCell Text="{Binding Title}" ImageSource="{Binding IconSource}" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentPage>
Run Code Online (Sandbox Code Playgroud)
我也改变了我的AppDelegate.cs文件根据@Steven下面是我改变的代码:
[Register("AppDelegate")]
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App());
UIToolbar.Appearance.TintColor = UIColor.Red;
UIToolbar.Appearance.BarTintColor = UIColor.Green;
return base.FinishedLaunching(app, options);
}
}
Run Code Online (Sandbox Code Playgroud)
这是由于该TintColor物业接管iOS.它使您能够以您想要的每种颜色提供图像,并且TintColor您可以使用任何颜色对其进行着色.为了改变这种尝试添加在你这行AppDelegate.cs:
UINavigationBar.Appearance.TintColor = UIColor.Red;
Run Code Online (Sandbox Code Playgroud)
这将为应用程序中的每个UINavigationBar设置图标样式.
| 归档时间: |
|
| 查看次数: |
2416 次 |
| 最近记录: |