如何将标题设置到导航栏的中心。我们可以不使用自定义渲染进行设置吗?我用过
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Toolbar Title" android:layout_gravity="center" android:id="@+id/toolbar_title" />
但是它不起作用
这是新的NavigationPage.TitleView的一种变态方式-默认情况下,Android似乎为后退按钮保留了标题视图的一部分,因此您可以设置一个偏移左边保留区域的边距:
<ContentPage>
<NavigationPage.TitleView>
<StackLayout>
<Label Text="More Text" TextColor="White" HorizontalTextAlignment="Center" FontSize="20" Margin="0, 0, 75, 0" />
</StackLayout>
</NavigationPage.TitleView>
...