为什么页面标题在TabbedPage
中默认为大写?
https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/navigation/tabbed-page
指向TabbedPage
文档的链接显示了示例的示例,其中选项卡式页面标题在代码中为Titlecase,在UI上为大写。
如下图所示:
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:TabbedPageWithNavigationPage;assembly=TabbedPageWithNavigationPage"
x:Class="TabbedPageWithNavigationPage.MainPage">
<local:TodayPage />
<NavigationPage Title="Schedule" IconImageSource="schedule.png">
<x:Arguments>
<local:SchedulePage />
</x:Arguments>
</NavigationPage>
</TabbedPage>
最佳答案
如果您查看GitHub上特定于Android的渲染器的源代码,则可以看到Xamarin.Forms internally uses TabLayout控件用于创建选项卡。这也意味着您将被Android开发人员指定为标题文本的外观所困扰,在这种情况下,默认情况下全部为大写。
但是,仍然可以通过创建自定义效果来自定义效果,该效果可以修改本机控件上的相关属性。看一下this article关于如何在Android上创建自定义效果的信息,您可能应该从以下SO question中找到要修改的属性。
通常,当您看到类似这样的内容时,这是因为Xamarin.Forms只是在使用本机控件而未对其进行任何修改或完全修改。到那时,您将需要创建和效果,甚至是自定义渲染器,以在更深层次上更改外观以适应您的需求。