Reputation: 113
How to set Title into center of Navigation Bar. Can we set without custom render. I have used
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Toolbar Title" android:layout_gravity="center" android:id="@+id/toolbar_title" />
But Its not working
Upvotes: 2
Views: 4647
Reputation: 2563
Here's one hackish way with the new NavigationPage.TitleView - Android seems to reserve a portion of the title view for the back button by default, so you can just set a margin that offsets the left hand reserved area:
<ContentPage>
<NavigationPage.TitleView>
<StackLayout>
<Label Text="More Text" TextColor="White" HorizontalTextAlignment="Center" FontSize="20" Margin="0, 0, 75, 0" />
</StackLayout>
</NavigationPage.TitleView>
...
Upvotes: 4