最佳答案
如果您使用的是基于 Shell 的 Xamarin.forms 应用那么您可以使用 Shell.TitleView 轻松实现此目的,定义您的标题内容,绑定(bind)它,甚至根据您的喜好设置样式。
在您的 ContentPage
中:
<Shell.TitleView>
<Label Text="Your Title" HorizontalTextAlignment="Center" HorizontalOptions="CenterAndExpand"/>
</Shell.TitleView>
您将避免使用自定义渲染器。
此外,如果您需要应用一些特殊的平台相关调整,您可以使用 OnPlatform .
关于xaml - 在 xamarin 中更改导航栏标题位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42556682/