C# 如何在Xamarin窗体中设置PageTille FontFamily和大小
我正在用Xamarin表单开发一个Android应用程序。页面文件是在XAML中创建的。但标题字体属性更改不可用。我的代码是:C# 如何在Xamarin窗体中设置PageTille FontFamily和大小,c#,android,xamarin,xamarin.forms,C#,Android,Xamarin,Xamarin.forms,我正在用Xamarin表单开发一个Android应用程序。页面文件是在XAML中创建的。但标题字体属性更改不可用。我的代码是: <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="MasterDetailPageNavigation.ContactsPage
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MasterDetailPageNavigation.ContactsPage"
Title="Home"
BackgroundColor="#ff6600">
<ContentPage.Content>
<StackLayout Padding="110,190,100,80">
<Button BackgroundColor="Transparent" TextColor="White" Image="Button.png"/>
<StackLayout Padding="25">
<Label Text="Button" TextColor="#ffffff" FontSize="Small"></Label>
</StackLayout>
</StackLayout>
</ContentPage.Content>
如何更改Title Fontstyle?请在
MainActivity.cs
行下方的LoadApplication(new App())中尝试此操作代码>
从这一点开始,然后在ContentPage
中添加:
<NavigationPage.TitleView>
<Label VerticalOptions="Center" MaxLine="1" FontFamily="/*OUR FONT GOES HERE*/" Text="Our new title" />
</NavigationPage.TitleView>
或:
您是在谈论操作栏/工具栏标题吗?这些链接名为Sheets..如果我的回答有助于您将其标记为正确,请联系我。这是一个很好的做法。我很感激使用Android.Text;并使用Android.Text.Style;如果我的回答有助于你将其标记为正确,请回答。这是一个很好的做法。我很感激。@jzeferino,这对我不起作用。我使用了.ttf,它可以很好地处理共享代码,并可以更改标签、条目、跨度等,。。。但当我按照指示使用该代码时,它不起作用。@Ali123我将代码更改为ttf。但是Android支持otf。
<NavigationPage.TitleView>
<Label VerticalOptions="Center" MaxLine="1" FontFamily="/*OUR FONT GOES HERE*/" Text="Our new title" />
</NavigationPage.TitleView>
<Shell.TitleView>
<Label VerticalOptions="Center" MaxLine="1" FontFamily="/*OUR FONT GOES HERE*/" Text="Our new title" />
</Shell.TitleView>